Menu

#168 plot2d doesn't detect all points clipped, only says "some clipped" and displays empty plot

None
open
nobody
5
2022-09-25
2022-03-28
No

plot2d detects clipped points, but previously (up to at least 5.42 and probably somewhat later) it would also detect if all points were clipped, and if so it would print an error message and not display a plot.

Here are two examples taken from tests/rtest_plot.mac (lines 299 and 301). Here is the output for the current version (commit f79bf97).

(%i2) plot2d (sqrt (x), [x, 0, 1], [y, -2, -1]);
plot2d: some values will be clipped.
(%o2)                                false
(%i3) plot2d (sqrt (x), [x, -1, 1], [y, -2, -1]);
plot2d: expression evaluates to non-numeric value somewhere in plotting range.
plot2d: some values will be clipped.
(%o3)                                false

Here is the output from 5.42.0:

(%i1) plot2d (sqrt (x), [x, 0, 1], [y, -2, -1]);
plot2d: all values were clipped.
plot2d: nothing to plot.
(%o1)                                false
(%i2) plot2d (sqrt (x), [x, -1, 1], [y, -2, -1]);
plot2d: all values are non-numeric, or clipped.
plot2d: nothing to plot.
(%o2)                                false

Note that the current version does correctly detect all points nonnumeric and refuses to display a plot:

(%i4) plot2d (sqrt (x), [x, -2, -1]);
plot2d: expression evaluates to non-numeric value everywhere in plotting range.
plot2d: nothing to plot.
 -- an error. To debug this try: debugmode(true);

Discussion

  • Jaime E. Villate

    Notice that the output of the current version is only apparently an empty plot: if you move it (click on the up arrow repeatedly or rotate the mouse wheel), the parabola will appear. In version 5.42.0 (and any other before 5.45) you don't get any plot.

    The clipping, which used to be done by Maxima, is now left to Gnuplot. Maxima has no way of knowing how Gnuplot is going to do the clipping; and keep in mind that different Gnuplot versions might behave differently. There are advantages (explained when the change was introduced) on letting Gnuplot do the clipping and disadvantages like this "bug". I still think that the new behavior is much better and this is not a bug but a feature.

     
  • Robert Dodier

    Robert Dodier - 2022-03-30

    I'd still like to see Maxima detect empty plots, but it's a low priority item; I'll move it to the enhancement request tracker.

    When the user specifies a y range as well as an x range, to figure out if there's anything to display just requires line-rectangle intersection -- I'm pretty sure this is straightforward. Incidentally it seems like it should work the same for all output types, not just Gnuplot.

    I don't think being able to scroll an empty plot to a region which contains some nonempty stuff is a reasonable use case; nobody is going to look at an empty plot and think of that.

     
  • Robert Dodier

    Robert Dodier - 2022-03-30

    Ticket moved from /p/maxima/bugs/3960/

     
  • Raymond Toy

    Raymond Toy - 2022-09-25

    I used to have a version of plot2d that kept track of the non-numerical points and printed them out. But this ends up causing lots of junk output if you did something like plot2d(abc, [x,0,1]), where abc is just the symbol abc. Most of my plotting errors were of this type. Or where the output is undefined for some interval. Only rarely did I have an plot with just a few isolated bad points where printing them out would have been useful.

    But detecting completely empty plots should be straightforward.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.