bugGNU Octave - Bugs: bug #32701, Incorrect plot - missing row

 
 

bug #32701: Incorrect plot - missing row

Submitter:  None
Submitted:  Mon 07 Mar 2011 04:38:08 PM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  bpabbott
Originator Name:  Moritz Berg Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.4.0
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 29 Mar 2011 11:08:07 PM UTC, comment #21: 

I've pushed the changeset.

Ben Abbott <bpabbott>
Group Member
Tue 29 Mar 2011 08:53:20 PM UTC, comment #20: 

I don't see this error on my machine, but the patch also doesn't cause any new problems for me.  Can it be committed and this bug report closed?

Rik <rik5>
Group administrator
Fri 11 Mar 2011 08:22:46 PM UTC, comment #19: 

This is getting embarrassing for me! ;-)

(file #22905)

Ben Abbott <bpabbott>
Group Member
Fri 11 Mar 2011 04:47:23 PM UTC, comment #18: 

And we need a fifth one: I still see min instead of max in tmp_lims(1)...

Marco

Marco Caliari <caliari>
Group Member
Fri 11 Mar 2011 03:42:30 PM UTC, comment #17: 

Ok. Fourth version is attached.

(file #22902)

Ben Abbott <bpabbott>
Group Member
Fri 11 Mar 2011 03:09:18 PM UTC, comment #16: 

And it is not correct: it should be


tmp_lims(1) = std::max (tick_sep * i2, hi);


(max and not min).

Marco

Marco Caliari <caliari>
Group Member
Fri 11 Mar 2011 03:02:40 PM UTC, comment #15: 

Your patch also contains something related with listeners. Was it intentional?

Marco

Marco Caliari <caliari>
Group Member
Fri 11 Mar 2011 02:57:32 PM UTC, comment #14: 

Good point Marco.

My 3rd changeset is attached.

(file #22901)

Ben Abbott <bpabbott>
Group Member
Fri 11 Mar 2011 08:43:18 AM UTC, comment #13: 

Dear Ben,

your patch works for me (I get 7.0 and 7.5 from get(gca,"ylim")). I would change the last part of your patch into


tmp_lims(0) = std::min (lo, tick_sep * i1);
tmp_lims(1) = std::max (hi, tick_sep * i2);


which gives me the same result, should work in general and does not introduces spurious DBL_EPSILON.

Marco

Marco Caliari <caliari>
Group Member
Thu 10 Mar 2011 05:58:39 PM UTC, comment #12: 

Thanks Marco. Have the problem isolated makes the job much easier.

I've attached another changeset that works for me. I'd appreciate is if you could verify this one works for you.

I'm still unfamiliar with this part of the code, so I've cc'd jwe and Shai.

(file #22881)

Ben Abbott <bpabbott>
Group Member
Thu 10 Mar 2011 08:38:45 AM UTC, comment #11: 

Dear Ben,

with your patch and few additional lines I was able to fix the problem for me. Your patch did not work because tmp_lims(0) was equal to lo (and to min_val) and both greater than xmin.

I'm not sure it is a real fix or just a workaround, because just printing the value of min_val was enough for me to fix. I would like to understand how just printing a value can change it!

My patch is versus 3.4.0.

Marco

(file #22876)

Marco Caliari <caliari>
Group Member
Wed 09 Mar 2011 05:20:54 PM UTC, comment #10: 

Ok. If you have any idea where the code needs to be changed, please make a suggestion.

I'm not very good at following the c++ code, but I'll take another look.

Ben Abbott <bpabbott>
Group Member
Wed 09 Mar 2011 03:56:06 PM UTC, comment #9: 

Dear Ben,

your patch does not work for me. I think the problem is more hidden: in fact, if I put


printf("%e",min_val);


before AND after


min_val = tick_sep * gnulib::floor (min_val / tick_sep);


in axes::properties::get_axis_limits, I get your y_limits.

Marco

Marco Caliari <caliari>
Group Member
Wed 09 Mar 2011 03:42:20 PM UTC, comment #8: 

I've attached a changeset. The axis limits were calculated correctly for me with and without this patch.

So, this will need to be tested by someone who sees this problem.



(file #22867)

Ben Abbott <bpabbott>
Group Member
Wed 09 Mar 2011 01:54:33 PM UTC, comment #7: 

Thanks Marco.

I've isolated the problem, and will post a patch when I get it fixed.

Ben


Ben Abbott <bpabbott>
Group Member
Wed 09 Mar 2011 11:17:28 AM UTC, comment #6: 

Hi.

I have the same behaviour of Moritz (linux x86 octave 3.4.0). I observed the following:


axis auto
y_limits = get(gca,"ylim");
y_limits(1)<=y(1)
ans = 0
axis tight
y_limits = get(gca,"ylim");
y_limits(1) <= y(1)
ans = 1


that is y_limits(1) > y(1) (due to floating point) with axis auto.

Marco

Marco Caliari <caliari>
Group Member
Tue 08 Mar 2011 05:32:45 PM UTC, comment #5: 


axis auto
x_limits =   10   30
y_limits =   7.1000   7.5000
z_limits =    0   20

axis tight
x_limits =   10   30
y_limits =   7.1000   7.5000
z_limits =    0   15

with

axis([10,30,  7.1,7.5,   0,15])

or

axis([10,30,  7.1,7.5,   0,20])

the plot is correct
only axis auto swallows the first row.

Moritz Berg <moritz_>
Tue 08 Mar 2011 04:24:41 PM UTC, comment #4: 

Looks  like the axis limits are not be set property. What do you get with ...


x = [10:2:30];
y = [7.1:0.1:7.5];
z = [1:11;2:12;3:13;4:14;5:15];
surf (x,y,z)
axis auto
x_limits = get (gca, "xlim")
y_limits = get (gca, "ylim")
z_limits = get (gca, "zlim")
axis tight
x_tight_limits = get (gca, "xlim")
y_tight_limits = get (gca, "ylim")
z_tight_limits = get (gca, "zlim")


I see ...


x_limits =   10   30
y_limits =   7.0000   7.5000
z_limits =    0   20


... and after "axis tight" ...


x_tight_limits =   10   30
y_tight_limits =   7.1000   7.5000
z_tight_limits =    1   15


Ben Abbott <bpabbott>
Group Member
Tue 08 Mar 2011 04:16:48 PM UTC, comment #3: 



with the command

axis tight

the plot is correct.

with axis auto the first row will be missed.
I think axis tight will solve my problem.

But axis auto works correct with other y-values and there are differences in the behavior in cygwin-octave and debian-ocatve.

Moritz Berg <moritz_>
Tue 08 Mar 2011 02:43:03 PM UTC, comment #2: 

Moritz,

If you get the same values for x/y/zdata that I obtained below, please run the command below and attach the debug.gp file.


drawnow ("pdf", "debug.pdf", false, "debug.gp")


We can examine the debug.gp plot stream and determine if the problem is with Octave or gnuplot.

Ben Abbott <bpabbott>
Group Member
Tue 08 Mar 2011 02:34:53 PM UTC, comment #1: 

I tried the first exampled with the developer's sources and got the correct result.

I'm running MacOS and using the gnuplot (v4.4) backend.

I've attached a pdf of the result (I added a "axis tight" before generating the pdf).


x = [10:2:30];
y = [7.1:0.1:7.5];
z = [1:11;2:12;3:13;4:14;5:15];
h = surf (x,y,z);
axis tight
print -dpdfwrite ex1.pdf


What do you get when you check the x/y/xdata properties?


get (h, 'xdata')
ans =

   10   12   14   16   18   20   22   24   26   28   30

get (h, 'ydata')
ans =

   7.1000
   7.2000
   7.3000
   7.4000
   7.5000

get (h, 'zdata')
ans =

    1    2    3    4    5    6    7    8    9   10   11
    2    3    4    5    6    7    8    9   10   11   12
    3    4    5    6    7    8    9   10   11   12   13
    4    5    6    7    8    9   10   11   12   13   14
    5    6    7    8    9   10   11   12   13   14   15


Ben Abbott <bpabbott>
Group Member
Mon 07 Mar 2011 04:38:08 PM UTC, original submission:  

Maschine: Intel Core 2 Duo E6600 2.00GB RAM
XP Professional Sp3
Cygwin 1.7.8-1
Octave 3.4
Gnuplot 4.4

The first row will not be drawed!
(possibly a problem of floating point condition?)

x = [10:2:30];
y = [7.1:0.1:7.5];
z = [1:11;2:12;3:13;4:14;5:15];
surf (x,y,z)
-> Plot missing: y = 7.1

x = [11:1:14];
y = [7.1:0.1:7.3];
z = [1:4;2:5;3:6];
surf (x,y,z)
-> Plot missing y = 7.1

x = [11:1:14];
y = [7.2:0.1:7.4];
z = [1:4;2:5;3:6];
surf (x,y,z)
-> Plot  y = 7.2 exist
The first row is drawed!

----------------------------------
the same with:

Linux Debian 5.0 Kernel 2.6.26
(Lenny live)
gnuplot_4.2.2-1.2
octave 3.0.1:3.0.1-6lenny3

x = [10:2:30];
y = [7.1:0.1:7.5]
z = [1:11;2:12:3:13;4:14;5:15];
surf (x,y,z)
-> Plot missing: y = 7.1

x = [11:1:14];
y = [7.1:0.1:7.3];
z = [1:4;2:5;3:6];
surf (x,y,z)
-> Plot missing y = 7.1

x = [11:1:14];
y = [7.2:0.1:7.4];
z = [1:4;2:5;3:6];
surf (x,y,z)
-> Plot  y = 7.2 exist

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #22905:  changeset.patch added by bpabbott (2KiB - application/octet-stream - 5th try)
file #22902:  changeset.patch added by bpabbott (2KiB - application/octet-stream - 4th version)
file #22901:  changeset.patch added by bpabbott (3KiB - application/octet-stream - my 3rd attempt)
file #22881:  changeset.patch added by bpabbott (2KiB - application/octet-stream)
file #22876:  graphics.cc.patch added by caliari (808B - text/x-patch)
file #22867:  changeset.patch added by bpabbott (1004B - application/octet-stream)
file #22848:  foo1.pdf added by None (5KiB - application/pdf)
file #22849:  foo2.pdf added by None (5KiB - application/pdf)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by bpabbott (Shai/John, please confirm this is a proper fix.)
  • -email is unavailable- added by bpabbott (Shai/John, please confirm this is a proper fix.)
  • -email is unavailable- added by caliari (Posted a comment)
  • -email is unavailable- added by moritz_ (Posted a comment)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 16 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-04-03 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2011-03-29 bpabbott StatusPatch Submitted Ready For Test
    2011-03-11 bpabbott Attached File- Added changeset.patch, #22905
    2011-03-11 bpabbott Attached File- Added changeset.patch, #22902
    2011-03-11 bpabbott Attached File- Added changeset.patch, #22901
    2011-03-10 bpabbott Attached File- Added changeset.patch, #22881
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
    2011-03-10 caliari Attached File- Added graphics.cc.patch, #22876
    2011-03-09 bpabbott Attached File- Added changeset.patch, #22867
        StatusConfirmed Patch Submitted
    2011-03-09 bpabbott StatusNone Confirmed
        Assigned toNone bpabbott
    2011-03-07 None Attached File- Added foo1.pdf, #22848
        Attached File- Added foo2.pdf, #22849

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code