bugGNU Octave - Bugs: bug #48429, gridcolor, minorgridcolor...

 
 

bug #48429: gridcolor, minorgridcolor properties not implemented for OpenGL toolkits

Submitter:  Rik <rik5>
Submitted:  Wed 06 Jul 2016 11:05:08 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 23 Sep 2016 02:58:53 PM UTC, comment #18: 

@Markus: Thanks for testing.  Closing report.

Rik <rik5>
Group administrator
Fri 23 Sep 2016 06:55:06 AM UTC, comment #17: 

Regarding your concern in comment #15, Rik: Octave seems to be Matlab compatible in this point. Run in Matlab:

>> plot (1:2)
>> set (gca, 'Xcolor', 'b');
>> set (gca, 'Xcolormode', 'auto');
>> get (gca, 'Xcolor')
ans =
     0     0     1
>> get (gca, 'Xcolormode')
ans =
auto


The axes keep there color when setting the mode to "auto".

I'll have a look whether I can find out why linewidth doesn't work for me when I'll have time. If something seems odd other than my setup, I'll open a new bug.

I think this bug here can be closed again.

Markus Mützel <mmuetzel>
Group administrator
Thu 22 Sep 2016 04:40:38 PM UTC, comment #16: 

Regarding transparency: There has been talk about moving the entire printing mechanism from using eps as an intermediate format to svg.  Instead of gl2ps->eps->other_formats via ghostscript, it would be gl2ps->svg->other_formats via svg converter of some sort.  This would have the advantage of getting us transparency for free.  Of course, this is a long term project that would happen after 4.2.0. release.

Rik <rik5>
Group administrator
Thu 22 Sep 2016 04:24:16 PM UTC, comment #15: 

The patch works.  I pushed it here http://hg.savannah.gnu.org/hgweb/octave/rev/5a1167e15c0e.

While testing the patch I ran across another potential incompatibility.  Does anyone have access to Matlab to test the following?


plot (1:2)
set (gca, 'Xcolor', 'b');
% At this point, X-axis is blue and 'XColorMode' is manual
set (gca, 'Xcolormode', 'auto');
% What happens?  Does the x-axis revert to [0.15, 0.15, 0.15]?
% In Octave, the axis stays blue.
% The easiest way to handle this would be on the transition from manual
% to auto for the following sample code to be run.
% set (gca, 'xcolor', get (0, 'DefaultAxesXcolor'))
% Let's see what Matlab did after the transition to auto
get (gca, 'Xcolor')



Rik <rik5>
Group administrator
Thu 22 Sep 2016 04:19:27 PM UTC, comment #14: 

Regarding transparency:
- The gl2ps page says: "Transparency is only supported for PDF and SVG output."

- For SVG blending is always enabled, whatever the state of GL_BLEND is.

If I run the gl2psTest, enable blending with "b" and save as SVG, Inkscape shows the transparency but I wasn't able to find a PDF viewer which shows transparency in PDF (tested evince and atril)

Andreas Weber <andy1978>
Group Member
Thu 22 Sep 2016 03:56:29 PM UTC, comment #13: 

The linewidth property works for me with qt or fltk.  Sample code


graphics_toolkit qt
plot (1:2)
set (gca, "linewidth", 5)
grid on


Maybe there is something else going on with your OpenGl renderer?  Are you using a HW renderer like Nvidia or AMD?

At the moment we don't have any transparency in the printed output.  We start gl2ps with the option GL_NO_BLENDING, but even when that is removed there is still something else going on.  I wouldn't worry about that for this bug report.

I'm testing your patch right now.

Rik <rik5>
Group administrator
Thu 22 Sep 2016 03:05:33 PM UTC, comment #12: 

Thank you, Rik, for finding that issue. I was not aware that this was the case. (Should have searched the docu more thoroughly, I guess...)

Attached a patch that should fix this.

I've realized that on-screen rendering does not respect the "linewidth" property for the axes, box and grid (with and without this patch). Is there an open bug for this issue?

I also don't see transparency in the png. But I think that this is a known issue that was discussed somewhere else before.

(file #38587)

Markus Mützel <mmuetzel>
Group administrator
Thu 22 Sep 2016 12:30:48 AM UTC, comment #11: 

Re-opening this bug report.  There seems to be a compatibility issue when the axis color property, such as 'Xcolor' or 'Ycolor', is manually set to a value.  In this case, the displayed color is supposed to follow the axis color property rather than 'gridcolor' or 'minorgridcolor'. 

See GridColorMode property at http://www.mathworks.com/help/matlab/ref/axes-properties.html.

Sample code.


plot (1:2)
grid on
set (gca, 'linewidth', 5, 'ycolor', 'r', 'ticklength', [0.05, 0.05])
saveas (gcf, "tst.png")



Rik <rik5>
Group administrator
Sun 21 Aug 2016 02:55:12 PM UTC, comment #10: 

I definitely don't get any Alpha effects, but maybe there is something wrong with my OpenGL set-up.

I filed a different bug report about the grid lines always overwriting the axes/box line (https://savannah.gnu.org/bugs/?48842).

Rik <rik5>
Group administrator
Sun 21 Aug 2016 02:36:16 PM UTC, comment #9: 

For the default values (0.15, 0.15, 0.15) see http://www.mathworks.com/help/matlab/ref/axes-properties.html.

I updated them not to long ago to match Matlab so I don't see any change required.

Rik <rik5>
Group administrator
Sun 21 Aug 2016 07:59:56 AM UTC, comment #8: 

I've attached a plot for Rik's question in comment #3 from Giorgio


Andreas Weber <andy1978>
Group Member
Sun 21 Aug 2016 07:53:54 AM UTC, comment #7: 

Update for comment #4:
We've currently disabled blending in
gl2ps-print.cc:248

GLint ret = gl2psBeginPage ("gl2ps_renderer figure", "Octave", 0,
                            gl2ps_term, gl2ps_sort,
                            (GL2PS_NO_BLENDING
                           | GL2PS_OCCLUSION_CULL


Andreas Weber <andy1978>
Group Member
Sun 21 Aug 2016 06:53:22 AM UTC, comment #6: 

And I guess now that alpha is implemented for grid, we need to set the default color to [0, 0, 0]

Until now it's

gridcolor = color_values (0.15, 0.15, 0.15);
...
minorgridcolor = color_values (0.1, 0.1, 0.1);


I'll ask on the mailinglist for defaults

Andreas Weber <andy1978>
Group Member
Sun 21 Aug 2016 06:46:15 AM UTC, comment #5: 

Sorry, in comment #4 I removed the minor grid for the image

Andreas Weber <andy1978>
Group Member
Sun 21 Aug 2016 06:45:19 AM UTC, comment #4: 

I see a difference with gridalpha

graphics_toolkit qt
subplot (2, 1, 1);
plot (1:10);
grid, grid minor
get (gca, "gridalpha")
get (gca, "minorgridalpha")
subplot (2, 1, 2);
plot (1:10);
grid, grid minor
set (gca, "gridalpha", 1)


shows the attached image. But apparently the qt print doesn't support gridalpha yet? Is this a gl2ps limitation?

produces the attached image


Andreas Weber <andy1978>
Group Member
Sat 20 Aug 2016 04:33:06 PM UTC, comment #3: 

The "gridcolor" and "minorgridcolor" work for me.  The "gridalpha" doesn't seem to effect anything.  I tried turning on the grid and then using


set (gca, "gridalpha", 0);  # completely transparent
set (gca, "gridalpha", 1);  # completely opaque


but I didn't see a difference.

Also, it seems that we draw the grid over the axes line sometimes.

Can someone with access to Matlab run these commands?


plot (1:10)
grid on
set (gca, 'gridcolor', 'r')
set (gca, 'xcolor', 'b', 'ycolor', 'g')


In Octave, all lines are red because the grid is covering the axes box.  If Matlab exposes the axes, then the solution will be to change the calculation of the tick locations in gl-render.cc that we pass to the render_grid function.

Rik <rik5>
Group administrator
Sat 20 Aug 2016 12:48:41 PM UTC, comment #2: 

Markus, thank you for your patch. I've pushed it here:
http://hg.savannah.gnu.org/hgweb/octave/rev/2b1612cf38e4

Andreas Weber <andy1978>
Group Member
Thu 14 Jul 2016 11:20:14 AM UTC, comment #1: 

Attached please find a patch that implements "gridcolor" and "minorgridcolor" for the OpenGL toolkits.

I also hijacked this bug to implement "gridalpha" and "minorgridalpha". Unlike general support for transparency in OpenGL, this is a one liner since the grid should always be drawn first on an empty background.

(file #37872)

Markus Mützel <mmuetzel>
Group administrator
Wed 06 Jul 2016 11:05:08 PM UTC, original submission:  

Steps to reproduce:


graphics_toolkit qt
plot (1:10);
grid on
grid minor on
set (gca, 'gridcolor', 'r');
set (gca, 'minorgridcolor', 'b');


The fix will be in opengl-renderer.cc

Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38298:  48429_axes_grid.png added by andy1978 (9KiB - image/png)
file #38297:  alpha.png added by andy1978 (18KiB - image/png)
file #37872:  opengl_grid.patch added by mmuetzel (6KiB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by rik5 (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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-23 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2016-09-22 mmuetzel Attached File- Added bug48429_grid_color_axis.patch, #38587
    2016-09-22 rik5 StatusFixed In Progress
        Open/ClosedClosed Open
    2016-08-23 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2016-08-21 andy1978 Attached File- Added 48429_axes_grid.png, #38298
    2016-08-21 andy1978 Attached File- Added alpha.png, #38297
    2016-08-20 andy1978 StatusNone Ready For Test
    2016-07-14 mmuetzel Attached File- Added opengl_grid.patch, #37872

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code