octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting Inf


From: Daniel J Sebald
Subject: Re: Plotting Inf
Date: Sun, 25 Mar 2007 18:39:54 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

Søren Hauberg wrote:
Hi,
I seem to be experiencing some problems plotting Inf's. The following code shows the problem

  plot(1:5)
  hold on, plot([3:4, inf]), hold off

After this the gnuplot window hangs. If I press Ctrl-C in the octave prompt after running the above code, I'm able to get gnuplot to repaint its window, but then it just produces an empty plot. Matlab seems to treat Inf just like NaN, i.e. don't plot the point. Octave seems to get NaN's right, so I guess it's only a minor change.

It seems you've discovered a gnuplot and Octave bug. The Inf is the problem, not the hold on/off. So I just ran the following:

plot([3:4, Inf])
<CNTL-C>
fid = fopen("junk.gp","w");
__go_draw_axes__(gca,fid)
fclose(fid)

which creates a file with:

set origin 0, 0;
set size 1, 1;
set size noratio;
unset title;
unset xlabel;
unset ylabel;
unset zlabel;
set grid noxtics;
set grid noytics;
set grid ztics;
set grid nomxtics;
set grid nomytics;
set grid nomztics;
set xtics;
set ytics;
set ztics;
set xtics;
set ytics;
set ztics;
unset logscale x;
unset logscale y;
unset logscale z;
set style line 1 default;
set style line 1 linecolor rgb "#0000ff" linetype 1 linewidth 0.500000 pointsize 1.000000;
set xrange [1:3] noreverse;
set yrange [NaN:NaN] noreverse;
set border 431;
unset key;
set style data lines;
plot "-" using ($1):($2) title "" with lines linestyle 1;
1 3
2 4
3 Inf
e

Of all the above code, it is the NaN inside

set yrange [NaN:NaN] noreverse;

that causes a problem.  (I will submit a bug report to gnuplot.)

On the other hand, another question is whether Octave should generate such a range [NaN:NaN] which I assume is a result of the Inf as part of the y data.

Dan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]