various plot2d issues



On Wed, 2007-04-04 at 14:37 -0400, Stavros Macrakis wrote:
> I realize that a lot of these bugs/misfeatures must be inherited
> from gnuplot, but we should be providing a clean, usable front end
> to any other tools we use, and not expose their idiosyncracies.
I fully agree with you.

> It would be handy if there were also a form that supplied an implicit
> counter for the x-axis, so that
> 
>         plot2d([series,s])
> 
> would be equivalent to
> 
>         plot2d([discrete,makelist(i,i,1,length(s)),s])
> 
> Is there an option I've missed?
There is currently such option. I can take charge of implementing
it.

> The obvious syntax would be [discrete,[y1,y2,...yi]], but
> unfortunately that is ambiguous between [discrete,[x,y]] and
> [discrete,[y1,y2]] when i=2; and those cases are possibly even useful
> when combined with other plotting commands.
I like that syntax an there is no ambiguity because in the current
version [discrete [2,3]] doesn't work. If you want to plot just one
point, you would use
   plot2d([discrete,[[2,3]]],[style,points])
I think we should keep it that way and extend the syntax so that
[discrete,[2,3]] is interpreted as [discrete,[[1,2],[2,3]]]

> plot2d is inconsistent in its treatment of UND (and other non-numeric
I think that's related to coerce-float-fun which should be Robert
Dodier to look at.


> ==Y-limiting and discrete==
> 
> Limiting the Y range doesn't seem to work with Discrete, e.g.
> plot2d([discrete,[0,1],[1,5],[2,1]],[y,0,3]]) ignores the [y,0,3]
> part.
You have unmatched brackets in that expression. The correct way is:
     plot2d([discrete,[[0,1],[1,5],[2,1]]],[y,0,3])
which works fine (the range is applies to all the functions
that might be inside the brackets, not just to the discrete data;
that's why I think it is wise to it out of the functions list.
Of course,
     plot2d([discrete,[[0,1],[1,5],[2,1]],[y,0,3]])
should simply ignore the yrange, rather than sending garbage to
gnuplot, which is what plot2d currently does. I will rework the
parsing of ranges in plot2d.

> When Y-limiting, plot2d *ignores* points outside the y-limits rather
> than drawing the line and clipping it at the Y-limit.
right, it does that for continuous functions. In the discrete case
plot2d passes all the values to the plotting program and lets it decide
what to show. I think that the correct behaviour in both cases would
be do do the clipping you suggest and do not give to the plotting
programs points that will not appear in the plot. That's another change
that I can do.

> plot2d doesn't understand INF.

once again, I think that's a coerce-float-fun issue.

> The number 1.0e308 seems to represent "missing value" for plot2d.  (I
> noticed this when trying to work with infinity; see above.) This is a
> very unmaximalike convention. Wouldn't it be better to use UND or
> something for this?
you're right. I will see where that magic number comes from.

> There is something weird going on with the way plot2d evaluates functions.
again, I think that's a coerce-float-fun issue which I do not know
how to handle.
Cheers,
Jaime