bugGNU Octave - Bugs: bug #40333, Changing the fontsize of a legend...

 
 

bug #40333: Changing the fontsize of a legend modifies axes position

Submitter:  Stefan Mahr <dac922>
Submitted:  Mon 21 Oct 2013 07:10:28 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 18 Nov 2019 08:05:31 PM UTC, comment #22: 

Verified with the new legend.m.  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Mon 18 Nov 2019 09:42:50 AM UTC, comment #21: 

legend.m has been rewritten for (OpenGL toolkits only). This bug should now be fixed.

Marking ready for test.

Pantxo Diribarne <pantxo>
Group Member
Thu 17 Nov 2016 06:57:19 PM UTC, comment #20: 

The following is enough to trigger the bug


hf = figure ();
plot (1:10);
hl = legend ("toto")
set (hf, "position", [0 0 200 200])
set (hl, "fontsize", 20)


Retitling the report.

Pantxo Diribarne <pantxo>
Group Member
Thu 17 Nov 2016 05:17:37 PM UTC, comment #19: 

If the root cause is the behavior of legend, then it is a legend bug and you should re-title this.

Rik <rik5>
Group administrator
Thu 17 Nov 2016 10:42:46 AM UTC, comment #18: 

This bug is still present in the current dev 4.3.0 (39f39eb4e476).

It is not directly related to printing, should I file a new report or retitle this one and make it yet another bug about legend?
 
I filed task #14243 about rewriting legend.m

Pantxo Diribarne <pantxo>
Group Member
Fri 26 Feb 2016 09:44:15 PM UTC, comment #17: 

@Ben: Changed bug category and summary as you suggested.

Rik <rik5>
Group administrator
Wed 30 Dec 2015 02:09:56 AM UTC, comment #16: 

@Rik,

Should the summary be changed to remove the reference to gnuplot?

The category as well?


Ben Abbott <bpabbott>
Group Member
Sun 15 Feb 2015 05:33:30 AM UTC, comment #15: 

Some things have improved over the last year.  I don't see the originally reported error of a shrinking axis/figure when using print with a legend.  On the other hand, the bug described in comment #12 with FLTK is still present.  This won't gate the 4.0 release.

Rik <rik5>
Group administrator
Thu 14 Nov 2013 07:10:11 PM UTC, comment #14: 

The results in comment #13 hold for my linux-system (ubuntu 12.04 64 bit). On windows (XP 32 bit, mxe-build cross compiled on linux) I get the following printing a figure with -depslatex:

  • gnuplot
    • gnuplot.exe in octave/bin: empty eps-file and an incomplete tex-file ending with \begin{picture}
    • externally installed gnuplot: complete eps-file and tex-file
  • fltk: print ignores -S parameter, only a part of the figure is printed, or nothing happens at all; I was not able to find out how to reproduce the single effects.
Torsten Lilge <ttl>
Group Member
Wed 13 Nov 2013 09:39:40 PM UTC, comment #13: 

Currently (hg id b602014eeb54 tip @) I can use gnuplot to correctly print the whole figure (with -depslatex) whereas fltk only prints a part of it (as described in comment #12)

Torsten Lilge <ttl>
Group Member
Thu 24 Oct 2013 05:09:15 PM UTC, comment #12: 

fltk is also affected when adding the -F option:


close all;
graphics_toolkit('fltk');
figure(1);
clf();
plot(0:1:10);
legend('test plot');
print('print_test.eps','-deps','-F:10','-S200,200')


The resulting print_test.eps is attached. Also attached a test with -depslatex (same result).

(file #29461, file #29462)

Torsten Lilge <ttl>
Group Member
Thu 24 Oct 2013 04:19:16 PM UTC, comment #11: 

Actually, it may be time to raise the priority
of the FLTK bug (cannot print without display)
so that FLTK can be used for the Manual.

Michael Godfrey <godfrey>
Group Member
Thu 24 Oct 2013 04:12:46 PM UTC, comment #10: 

Well, as long the docs can't be build with FLTK, I think gnuplot should have the same priority. For example: Look for 'interpderiv2.eps' or figure 29.1 in octave.pdf.

Stefan Mahr <dac922>
Thu 24 Oct 2013 03:44:27 PM UTC, comment #9: 

I'm re-opening the bug report for gnuplot.  gnuplot is no longer the default plotting engine so this won't gate the 3.8 release.

The shrinking problem is due to the fact that legend.m has to do even more weird contortions than for FLTK to support them.

I tried the size option "-S" with octave-3.6.4 and it produced awful results, different from what I get now, but still really bad.  I'm not sure this feature has ever worked very well with gnuplot.

Rik <rik5>
Group administrator
Thu 24 Oct 2013 11:04:57 AM UTC, comment #8: 

Rik, did you try the gnuplot example below? I can confirm that the bug is fixed for fltk, but with gnuplot the bug still occurs.

I can confirm Torstens bug. Attached the resulting .eps file. In addition a screenshot (.png) of the plot after the print command.


file #29457)

Stefan Mahr <dac922>
Thu 24 Oct 2013 10:14:27 AM UTC, comment #7: 

I still have problems when printing with the "size"-options but I am not sure if this is related to this bug.
Steps to reproduce:


close all;
graphics_toolkit('gnuplot');
figure(1);
clf();
plot(0:1:10);
legend('test plot');
print('print_test.eps','-deps','-S200,200');


The eps-file only contains the lower left part of the figure. When printig without legend or using fltk everything works as expected.

Torsten Lilge <ttl>
Group Member
Thu 24 Oct 2013 12:48:03 AM UTC, comment #6: 

Thanks Rik.  The bug was my fault.  I had reversed the order of restoring the properties thinking that would restore things to their original state .... looks like I got it backwards

Ben Abbott <bpabbott>
Group Member
Thu 24 Oct 2013 12:17:32 AM UTC, comment #5: 

I think I've fixed the problem with this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/4e225f952885).  At any rate, the test script no longer shrinks the axes.

Rik <rik5>
Group administrator
Tue 22 Oct 2013 04:22:33 PM UTC, comment #4: 

Confirmed with hg id 132d9f543cc5.  The problem is going to be in legend.m.  There has always been issues returning the size of the axes to the original values when deleting or re-creating the legend object (such as for a fontsize change).

Rik <rik5>
Group administrator
Tue 22 Oct 2013 03:18:54 PM UTC, comment #3: 

I can confirm this with default 132d9f543cc5 (after fix of bug 40334)


close all
graphics_toolkit fltk
for k=1:6
  plot(1:2);
  legend('a');
  print('test.png','-F:20');
  get (gca, 'outerposition')
endfor



close all
graphics_toolkit gnuplot
for k=1:6
  plot(1:2);
  legend('a');
  print('test.png');
  get (gca, 'outerposition')
endfor


Andreas Weber <andy1978>
Group Member
Mon 21 Oct 2013 08:55:15 PM UTC, comment #2: 
Stefan Mahr <dac922>
Mon 21 Oct 2013 08:43:18 PM UTC, comment #1: 

This bug seems somehow related to this bug https://savannah.gnu.org/bugs/?40333

If using print with setting font size (that returns with an error), the position of the axis changes like with gnuplot.


graphics_toolkit fltk
plot(1:2);
legend('a');
aout = get (gca, 'outerposition');

try, print('test.png','-F:20'); end

bout = get (gca, 'outerposition');
assert(bout,aout,0.001)


Stefan Mahr <dac922>
Mon 21 Oct 2013 07:10:28 PM UTC, original submission:  


close all
graphics_toolkit gnuplot

plot(1:2);
legend('a');
apos = get (gca, 'position');
aout = get (gca, 'outerposition');

print('test.png')

bpos = get (gca, 'position');
bout = get (gca, 'outerposition');

assert(bpos,apos,0.001)
assert(bout,aout,0.001)


If plot and print are executed within a loop without closing the figure each time, the axes get smaller and smaller.

Stefan Mahr <dac922>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #29461:  print_test-inc.eps added by ttl (5KiB - image/x-eps)
file #29462:  print_test.eps added by ttl (5KiB - image/x-eps)
file #29456:  print_test.png added by dac922 (9KiB - image/png)
file #29457:  print_test.eps added by dac922 (23KiB - image/x-eps)

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by ttl (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 andy1978 (Posted a comment)
  • -email is unavailable- added by dac922 (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 20 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-11-18 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-11-18 pantxo StatusConfirmed Ready For Test
    2018-03-06 pantxo Dependencies- bugs #51796 is dependent
    2016-11-18 siko1056 Dependencies- task #14243 is dependent
    2016-11-17 pantxo Summaryprint with legend modifies axis position Changing the fontsize of a legend modifies axes position
    2016-02-26 rik5 CategoryPlotting with gnuplot Plotting
        Summaryprint with legend modifies axis position (gnuplot) print with legend modifies axis position
    2013-10-24 ttl Attached File- Added print_test-inc.eps, #29461
        Attached File- Added print_test.eps, #29462
    2013-10-24 rik5 CategoryPlotting Plotting with gnuplot
        StatusFixed Confirmed
        Open/ClosedClosed Open
        Summaryprint with legend modifies axis position print with legend modifies axis position (gnuplot)
    2013-10-24 dac922 Attached File- Added print_test.png, #29456
        Attached File- Added print_test.eps, #29457
    2013-10-24 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2013-10-22 andy1978 CategoryPlotting with gnuplot Plotting
        Item GroupNone Regression

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code