bugGNU Octave - Bugs: bug #48148, plottting with title and unboxed...

 
 

bug #48148: plottting with title and unboxed legend fails

Submitted by:  Juan Pablo Carbajal <juanpi>
Submitted on:  Mon 06 Jun 2016 03:03:24 PM UTC  
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  None 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)

Sun 12 Jun 2016 08:59:04 AM UTC, comment #10: 

Hi,

The patch has been merged upstream. The fix will be part of the next version of gl2ps.

Pantxo Diribarne <pantxo>
Project Member
Sat 11 Jun 2016 04:48:38 AM UTC, comment #9: 

I fixed the other bug, Octave was drawing parts of legend objects even when "visible" was "off", in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/f2b5499e8662).

Rik <rik5>
Project Administrator
Fri 10 Jun 2016 07:20:08 PM UTC, comment #8: 

@Rik: Sure, go ahead, I'll post a comment here anyway when I have news from gl2ps.

Pantxo Diribarne <pantxo>
Project Member
Fri 10 Jun 2016 04:06:02 PM UTC, comment #7: 

Can we mark this as an upstream bug then and close this report?

Actually, there is the separate issue that setting "visibility" to "off" on a legend object should completely hide the legend.  I know roughly where in gl-render.cc this fix belongs and hope to get to it this weekend.

Rik <rik5>
Project Administrator
Fri 10 Jun 2016 03:06:43 PM UTC, comment #6: 

Hi,

This is definitely a bug in gl2ps. I proposed a very simple patch there.

Pantxo Diribarne <pantxo>
Project Member
Tue 07 Jun 2016 11:42:48 AM UTC, comment #5: 

I also obtain the same results as Philip on R2016a. Note however that legend object don't behave like axes objects in this regard: when setting "visible" to "off" on axes objects, only the axes lines, the tick labels and the "x/y/zlabel" and "title" are hidden. The other children objects (lines, patches ...) are drawn.
So Octave behaves exactly as ML for axes objects and not for legend objects.

In ML you need to use "legend boxoff" to hide only the legend box, not the whole legend. This also works in Octave

Now about the missing legend labels in Octave printout when you hide the box, if you look carefully (in Rik's example) you'll see that the text is drawn but white. FWIW this doesn't happen with the svg format:

plot (1:10);
legend abc
legend boxoff
title ('legend boxoff');
print toto.svg

works as expected.
I checked in gl2ps-print.cc that the correct color is set prior to calling "gl2psTextOpt". It looks like a bug in gl2ps when using multiple viewports but I have no real clue ATM. 

Pantxo Diribarne <pantxo>
Project Member
Tue 07 Jun 2016 11:06:36 AM UTC, comment #4: 

Here we go w. r2014a; the screenshot + the printed figure (file).


Philip Nienhuis <philipnienhuis>
Project Member
Mon 06 Jun 2016 04:48:42 PM UTC, comment #3: 

I've attached two png figures which shows what box "on"/"off" should look like for a simple plot.  It's doing the right thing for me.

We will need to get someone with access to Matlab to test the following:

plot (1:10);
hl = legend ('abc');
set (hl, 'visible', 'off');
title ('Legend with "visible" set to "off"');
print -dpng legvis.png


Rik <rik5>
Project Administrator
Mon 06 Jun 2016 04:31:26 PM UTC, comment #2: 

I do not have access to matlab.

The box option is not working form me under fltk or qt. It does work under gnuplot.

invisible is not hiding the content of the axes, only the axes. If I do
set(gca,"visible",'off')

only the axes disappear under gnuplot, fltk and qt.

Juan Pablo Carbajal <juanpi>
Project Member
Mon 06 Jun 2016 04:17:04 PM UTC, comment #1: 

I think there are different issues at work here.  If you change the visibility of a graphics object to "off" it, shouldn't all of it's children disappear as well?  This certainly works with

set (gcf, 'visible', 'off')

which causes the entire figure to disappear.  It also works this way with hggroup.

If you have access to Matlab, could you test what happens to the legend on screen when you make it invisible?

The set command for box works for me.

plot (1:10)
hl = legend ('abc');
set (hl, 'box', 'off');

This turns off the box, but remember that a legend is made from an axes object.  Turning off the box won't turn off the x and y axes.  You will do better to hack it by changing the axes colors to the color of the background, usually white.

set (hl, 'xcolor', 'w');
set (hl, 'ycolor', 'w');

Rik <rik5>
Project Administrator
Mon 06 Jun 2016 03:03:24 PM UTC, original submission:  

This might be related with bug #40334

This prints a png without the legend labels. This is not the case in 4.0.0

h = plot(rand(10,3));
hl = legend(h, {"1","2","3"});
title ("Parameter value")
set(hl, "visible", "off");
print('-dpng','/tmp/test.png')

note that it is due to title since this works fine

clf
h = plot(rand(10,3));
hl = legend(h, {"1","2","3"});
set(hl, "visible", "off");
print('-dpng','/tmp/test.png')

btw, I set the legend invisible to remove the box since set (.., "box", "off") does't have any effect.

Juan Pablo Carbajal <juanpi>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #37420:  legvis.png added by philipnienhuis (10KiB - image/png)
file #37410:  box_on.png added by rik5 (20KiB - image/png)
file #37411:  box_off.png added by rik5 (20KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by juanpi (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-06-10 rik5 StatusNeed Info => None
        Open/ClosedOpen => Closed
    2016-06-07 philipnienhuis Attached File- => Added legvis_screenshot.png, #37419
        Attached File- => Added legvis.png, #37420
    2016-06-06 rik5 Attached File- => Added box_on.png, #37410
        Attached File- => Added box_off.png, #37411
    2016-06-06 rik5 StatusNone => Need Info

    Back to the top


    Powered by Savane 3.5