bugGNU Octave - Bugs: bug #35648, patches printed above grid lines...

 
 

bug #35648: patches printed above grid lines even with 'layer' = 'top'

Submitted by:  Muhali <muhali>
Submitted on:  Mon 27 Feb 2012 10:29:34 PM UTC  
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Wed 30 Apr 2014 06:37:20 PM UTC, comment #18: 

It's related.  Legend objects are implemented by Matlab, and also Octave, as a second axes object on the figure.  This is kind of a weird re-use and the OpenGL drawing code is not set up for it.  I'm going to have to think about this for a while to see if there is a clean solution.

Rik <rik5>
Project Administrator
Wed 30 Apr 2014 11:17:07 AM UTC, comment #17: 

I'm not sure the problem is related to your fix but if there's a legend on a chart then its face is being moved to the bottom layer when printed while all the edges are still shown.

Can anyone confirm the result of the following code? Attached file was made with cset 95a1ee1cbdf1.

print('-depsc','123.eps')
close all
patch([1 1 2 2],[1 2 2 1], [1 0.8 1])
legend('ptch legend entry')
grid on

(file #31285)

sergey plotnikov <nul0m>
Tue 29 Apr 2014 06:55:10 PM UTC, comment #16: 

I believe I have fixed the Z-order printing problem in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/abd8d8c686c9).  The bug can be re-opened if new examples are found which cause a problem.

Rik <rik5>
Project Administrator
Wed 16 Apr 2014 12:42:34 AM UTC, comment #15: 

Interestingly, this does work if the patch is 3-D, but with all Z=0.  I suspect something odd in the difference between 2-D/3-D code with OpenGL itself.

Using your example,

hp = patch([1 1 2 2],[1 2 2 1], [1 0.8 1]);
grid on;
set(gca,'layer','bottom');
## At this point, grid is still shown above patch
set (hp, 'zdata', [0 0 0 0]');
## Now changing 'layer' works

Rik <rik5>
Project Administrator
Tue 15 Apr 2014 01:59:39 PM UTC, comment #14: 

Confirmed.  The 'layer' attribute does not seem to have an effect for patches.

It does work with line objects.

hl = plot (1:10, 'm');
set (hl, 'linewidth', 4);
grid minor
set (gca, 'minorgridlinestyle', '-');

Now if you zoom in on a section where the line crosses the minor grid axis you can change which one is on top with

set (gca, 'layer', 'top');
set (gca, 'layer', 'bottom');

I think the issue is that this behavior has never been coded in gl-render.cc for patch objects.

Rik <rik5>
Project Administrator
Tue 15 Apr 2014 09:22:07 AM UTC, comment #13: 

Actually, on-screen rendering for a simple patch doesn't seem to be working well.

patch([1 1 2 2],[1 2 2 1], [1 0.8 1]);
grid on;
set(gca,'layer','top');
set(gca,'layer','bottom');

In the example above grid lines appears to be always at the top layer, which doesn't coincide with Matlab, where layer option change affects them.

Can anyone confirm it?

sergey plotnikov <nul0m>
Sun 16 Mar 2014 07:57:02 PM UTC, comment #12: 

I just re-ran the example in this bug report with a development tip (3a1a4d587c4e) and I still get the problem.  At least the on-screen rendering is now fixed, but printing doesn't respect the 'layer' property of the axis.  I re-titled the bug report to reflect that.

Rik <rik5>
Project Administrator
Thu 01 Mar 2012 12:48:14 PM UTC, comment #11: 

I'm using fltk 1.1.10 from MacPorts. There have been several cases where fltk on MacOS (aqua) doesn't behave in the same manner as on x11 (for example see the attached figure window I "close all; axis")

$ port info fltk
fltk @1.1.10, Revision 3 (aqua, devel)

Description:          FLTK (pronounced fulltick) is a cross-platform C++ GUI
                      toolkit for UNIX/Linux (X11), Microsoft Windows, and Mac
                      OS X. FLTK provides modern GUI functionality without the
                      bloat and supports 3D graphics via OpenGL and its built-in
                      GLUT emulation. FLTK is designed to be small and modular
                      enough to be statically linked, but works fine as a shared
                      library. FLTK also includes an excellent UI builder called
                      FLUID that can be used to create applications in minutes.
Homepage:             http://www.fltk.org/

Library Dependencies: jpeg, libpng, zlib
Conflicts with:       fltk-devel
Platforms:            macosx
License:              LGPL
Maintainers:          nomaintainer@macports.org


Ben Abbott <bpabbott>
Project Member
Thu 01 Mar 2012 01:09:54 AM UTC, comment #10: 

I am using fltk 1.3.0 as comes with
Fedora 16.

Michael Godfrey <godfrey>
Project Member
Wed 29 Feb 2012 11:12:46 PM UTC, comment #9: 

What version of FLTK are Ben or Michael using?  I have 1.10 and the grid is always under the color squares both on screen and in the printed version.  Gnuplot works fine and the 'layer' command works with that backend.

Rik <rik5>
Project Administrator
Wed 29 Feb 2012 07:02:33 PM UTC, comment #8: 

I'm attaching the Octave+Gnuplot results for

colormap ("default");
imagesc (randi (64, 5, 5));
grid on;
set (gca,'layer','top');
print -dpdfwrite octave_imagesc_grid.pdf
print octave_imagesc_grid.png

Octave's pdf output looks like Matlabs (the eps version does as well). Apparently, we're compatible with Matlab ?

I don't understand how the eps/pdf version are smeared, but the png is not.

(file #25216,

Ben Abbott <bpabbott>
Project Member
Wed 29 Feb 2012 06:01:48 PM UTC, comment #7: 

It is possible that you've found a bug in Matlab.

One last thing to check, however, is the value of the 'layer' property for the current axis.  According to Matlab, 'layer' can be either 'top' or 'bottom'.  When it is 'top', the axis is drawn over the line objects and other items at Z-stack = 0.  When it is 'bottom' {default} any other objects at Z-stack = 0 are on top of the axis.

I'm attaching a script (mk_bad_plots.m) which demonstrates the problem.  gnuplot does the correct thing, incidentally, and if you zoom in to the top of the plot where the sine curve touches the axis you can see which one is on top.

(file #25215)

Rik <rik5>
Project Administrator
Wed 29 Feb 2012 01:09:26 PM UTC, comment #6: 

Matlab give different results for pdf and png.

I looks to me as if the pdf result isn't rendered correctly (a bug?).

Matlab's png looks like Octave's.

I think the grid lines should be visible. Perhaps we should just draw the grid lines last ?

file #25214)

Ben Abbott <bpabbott>
Project Member
Wed 29 Feb 2012 05:20:19 AM UTC, comment #5: 

Rik,

Using 3.6.1 on Fedora 16 your example below
shows correct grid lines on screen and in PDF.

Michael Godfrey <godfrey>
Project Member
Wed 29 Feb 2012 04:47:04 AM UTC, comment #4: 

I can't confirm the print output because I don't even get a grid with the onscreen version.  The following should produce multicolor blocks with lots of grid lines, and it does that with gnuplot but not with FLTK.

colormap ("default");
imagesc (randi (64, 5, 5));
grid minor;

I checked the axes properties with 'get (gca)' and all the grid properties are correctly turned on but no lines are drawn.

Actually, I just figured it out.  This is a problem with Z-stacking order again.  The colored squares from imagesc are drawn above the axis.  Therefore, even when the grid is turned on it is hidden.  You can see that this is happening by using the example above and

axis ([0, 6, 0, 6])

How does Matlab behave for any of these examples?

Rik <rik5>
Project Administrator
Wed 29 Feb 2012 03:35:24 AM UTC, comment #3: 

I can confirm Mulali's example.

Rik, do you see it too?

Ben Abbott <bpabbott>
Project Member
Tue 28 Feb 2012 01:43:52 AM UTC, comment #2: 

that may have been too general. Try this:

colormap([1 1 1; 0 0 0]) ;
imagesc(double(randn(5,5)<0))
set (gca, "ygrid", "on");
print foo.png

Muhali <muhali>
Tue 28 Feb 2012 01:20:21 AM UTC, comment #1: 

This works for me with the FLTK backend

plot (1:10);
set (gca, "ygrid", "on");
print foo.png

This might be something particular about your version of Octave or FLTK.

Rik <rik5>
Project Administrator
Mon 27 Feb 2012 10:29:34 PM UTC, original submission:  

as a follow-up to bug 35559,

for any plot

set(gca, "ygrid", "on")

displays the dotted grid lines in the plot but not in the print.

Muhali <muhali>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #31285:  123.eps added by nul0m (8KiB - image/x-eps)
file #25228:  Initial_Figure.png added by bpabbott (29KiB - image/png - initial fltk figure on macos)
file #25216:  octave_imagesc_grid.pdf added by bpabbott (4KiB - application/pdf)
file #25215:  mk_bad_plots.m added by rik5 (201B - text/x-octave)
file #25214:  matlab_imagesc_grid.pdf added by bpabbott (11KiB - 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 nul0m (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by muhali (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-04-30 nul0m Attached File- => Added 123.eps, #31285
    2014-04-29 rik5 StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2014-03-16 rik5 Item GroupNone => Incorrect Result
        Summarylines not printed, cont. => patches printed above grid lines even with 'layer' = 'top'
    2012-03-01 bpabbott Attached File- => Added Initial_Figure.png, #25228
    2012-02-29 bpabbott Attached File- => Added octave_imagesc_grid.pdf, #25216
        Attached File- => Added octave_imagesc_grid.png, #25217
    2012-02-29 rik5 Attached File- => Added mk_bad_plots.m, #25215
    2012-02-29 bpabbott Attached File- => Added matlab_imagesc_grid.png, #25213
        Attached File- => Added matlab_imagesc_grid.pdf, #25214
    2012-02-29 bpabbott StatusWorks For Me => Confirmed
    2012-02-28 rik5 CategoryNone => Plotting with OpenGL
        StatusNone => Works For Me

    Back to the top


    Powered by Savane 3.5