Re: [metafont] Graph.mp annoyances

"Daniel H. Luecking" <[email protected]> Tue, 09 Sep 2003 14:33:50 -0500 (CDT)
Newsgroups gmane.comp.tex.metapost,gmane.comp.tex.metafont
Message-ID <[email protected]>
On Tue, 9 Sep 2003, Brian Elmegaard wrote:

> Hi all,
>
> I am using the metapost graph macro a lot, but it has a few minor
> annoyances. Maybe some of you have already solved the following problems:
>
> * The direction of arrowheads in gdrawarrow does not follow the curve it
> is on.

This may be because the direction is undefined at corners of a path. MP
usually uses (postcontrol - precontrol), which doesn't usually match
either the in or the out direction. graph.mp uses instead (point -
precontrol) as the direction, generally a better choice. However, if the
path is rather curved near the head, it may seem to be incorrect, with
the edge of the head closer to the path on the inside of the curve.
Still, the head does point in the direction of the tangent at the
endpoint of the curve.

It is really quite difficult to algorithmically choose an arrowhead.
(I know, I've tried.) The best looking results can be achieved by
putting the *base* of the arrowhead (rather than the tip) at the path's
endpoint. But most people don't want to allow that.

>
> * Reading data from a file only works if there is exactly one empty line
> between data for each curve and the error message is not helpful

All graphing programs I know of require a particular format for the data
file. Some give no error and simply stop at a double blank line. One
simply has to know the rquirements for input.

>
> * Data with exponent as 1e4 cannot have a capital E.
>
> * Curves from data are always polygonal, unless one changes the true
> argument to GMcvi_ in Gdraw_. If this is set to false a very special
> kind of curve is created. Why does the branch for false have post- and
> precontrol of the curve, not just .. which makes a nice, smooth curve?

Because ".." will often not make a *nice* smooth curve. Without
selecting the controls, such a connection will often make S-shapes in
the graph (where the curve turns in the negative horizontal direction
briefly) if the data varies rapidly. In such cases the graph should not
be too smooth. Admittedly, I don't know how graph.mp chooses controls,
nor whether there might be better choices, but for general purposes,
some choice is unavoidable.

Regards,

-- 
Dan Luecking                           Dept. of Mathematical Sciences
[email protected]                      University of Arkansas
http://comp.uark.edu/~luecking/        Fayetteville, AR 72101