ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mojca Miklavec <mojca.miklavec.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Plotting a graph of a function f, like f(x) = e^x, with MetaPost
Date: Thu, 13 Oct 2011 02:30:07 +0200	[thread overview]
Message-ID: <CALBOmsbu6kcB+TmKnnBobYAPOnNekpSbUmeqZPj4Kinq=RQxrQ@mail.gmail.com> (raw)
In-Reply-To: <1318461575.1055.38.camel@mattotaupa>

On Thu, Oct 13, 2011 at 01:19, Paul Menzel wrote:
> Am Donnerstag, den 13.10.2011, 00:28 +0200 schrieb Mojca Miklavec:
>> On Thu, Oct 13, 2011 at 00:13, Paul Menzel wrote:
>> > Am Mittwoch, den 12.10.2011, 07:36 +0200 schrieb Alan Braslau:
>> >
>> >> Metapost can now perform calculations in double precision floating point.
>> >> At this time, it is in the svn version and does not work yet as
>> >> such integrated in ConTeXt (through mplib). Taco promises this for soon...
>> >
>> > great to hear that. Just to clarify, with »now« you mean MetaPost v2, do
>> > not you?
>>
>> No, 1.750. The version 2 is not quite ready yet, but the version 1.750
>> already deals with floating point numbers.
>
> Thank you for the clarification/correction.
>
>> > Taco, I hope you get there without a lot of problems showing
>> > up. If you need testers a good option would be to integrate that into
>> > ConTeXt Standalone as an option.
>>
>> It will become part of distribution as soon as it gets out, but Taco
>> was busy enough organizing conference and dozens of other things. Just
>> give him some time. I bet that he also wants to update documentation,
>> do final bugfixing etc. instead of just releasing a random snapshot.
>
> Of course the user would have to make a conscious decision by enabling
> this “beta” release.

And of course the user makes a conscious decision to either compile
from trunk if he wants the latest and greatest bugs and new features
or to wait patiently until Taco thinks the software is ready and
releases a beta.

I don't think that one extra week (or two or three or ... for that
matter) makes any difference.

> If people could test this and with the right
> announcement I hope that some people would step up to test and
> contribute by submitting bug reports or writing documentation.

If people could test LaTeX 3 ... they would most certainly send bug
reports and write docs.

There will be more than enough time for testing before version 2 is
out. Those who want to help writing documentation are already free to
do so. The code already works.

>> > One thing coming to my mind though that hopefully the wheel is not
>> > reimplemented. I guess Gnuplot can do a lot already, but on the other
>> > probably not as neat as Metapost when we want to color certain areas.
>>
>> Can you please specify your question more precisely?
>
> I meant coloring part of the area below a graph. For example if you look
> at the graphic for Riemann sums on page 51 of the document »Learning
> MetaPost by Doing« [6].

I'm not sure how to draw discrete function, but you can try out the following:

set style fill solid border -1
f(x)=(x-5)*sin(x)-cos(x)+2

plot [1:7] f(x) w filledcurve y1=0,\
'-' using 1:(f($1)) w boxes lt 0, f(x) lt -1 lw 3
1.5
2.5
3.5
4.5
5.5
6.5
e

(But of course you need to draw everything else as well.)

>> Gnuplot terminal uses metapost output. Gnuplot has some support for
>> transparency, even though I'm not exactly sure if one can specify
>> transparent colors for lines, only for fills. But you can always
>> simply redefine line type colors to be transparent.
>>
>> Gnuplot brings all kinds of other problems like dependency on external
>> tool. If you have enough time to create nice plots in metapost, it is
>> better to avoid external dependency as a general rule. But if you have
>> more questions about it, feel free to ask. I might be able to help
>> you.
>
> Well my only question would be, why should someone use Gnuplot then? Is
> it only for people already knowing Gnuplot? Or also because it is a
> little less work to define the coordinate system and legends?

It is much less work to define and draw coordinate system, choose the
right units, draw logarithmic plots, parse input data, (past tense: do
arithmetics with numbers above 4000), ...

> Otherwise MetaPost seems to include all functionality Gnuplot offers and
> seems to offer more possibilities, does not it?

MetaPost doesn't know erf and other obscure functions, it wasn't able
to calculate with big numbers and it is very inconvenient to parse
input data. With gnuplot you get fast plotting, data parsing, range
guessing, function calculations ... all "for free", but you have
slightly less flexibility in drawing. For me the most important part
is that I have to use gnuplot for inspecting the data anyway (I would
never use metapost to quickly inspect whether my measurement went fine
or not) and then I just copy-paste the function call. The trade-off is
still in favour of gnuplot, in particular since the quality is
acceptable and I don't have any special needs and extra time to do
fancy stuff with plots. What I really miss in Gnuplot is 3D support,
but that one is not covered in MetaPost either.

> I remember a thread about that [9].

That was not the same. The last context-terminal-was-almost-included
was something recent (less than a month ago).

Mojca
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2011-10-13  0:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11 22:45 Paul Menzel
2011-10-11 22:56 ` Paul Menzel
2011-10-11 22:58 ` Mojca Miklavec
2011-10-12  5:36 ` Alan Braslau
2011-10-12 22:13   ` Paul Menzel
2011-10-12 22:28     ` Mojca Miklavec
2011-10-12 23:19       ` Paul Menzel
2011-10-13  0:30         ` Mojca Miklavec [this message]
2011-10-13  7:32           ` Hans Hagen
2011-10-13  7:59           ` Alan Braslau
2011-10-13  8:04             ` luigi scarso
2011-10-12  6:40 ` luigi scarso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALBOmsbu6kcB+TmKnnBobYAPOnNekpSbUmeqZPj4Kinq=RQxrQ@mail.gmail.com' \
    --to=mojca.miklavec.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).