bugGNU Octave - Bugs: bug #58492, Setting DataAspectRatio moves...

 
 

bug #58492: Setting DataAspectRatio moves legend out of axes

Submitter:  A.R. Burgers <arb>
Submitted:  Wed 03 Jun 2020 02:33:04 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:  * 6.0.90 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 05 Jun 2020 08:05:36 AM UTC, comment #6: 

Thanks, I pushed the patch:

http://hg.savannah.gnu.org/hgweb/octave/rev/26d69b0a3e8d

Closing report as fixed.

Pantxo Diribarne <pantxo>
Group Member
Fri 05 Jun 2020 06:42:54 AM UTC, comment #5: 

I can confirm this fixes the issue with the drifting legend.

A.R. Burgers <arb>
Thu 04 Jun 2020 01:51:58 PM UTC, comment #4: 

This is a regression I introduced with the previous patch. The attached patch fixes the regression and the bug at hand for me. Can you confirm?



(file #49211)

Pantxo Diribarne <pantxo>
Group Member
Thu 04 Jun 2020 01:34:06 PM UTC, comment #3: 

The inside/outside issue appears to be fixed!

Modifying the script slightly and comparing the legend position with/without DataAspectRatio set, I notice on horizontal resize of figure f2, in the OpenGL case the legend moves horizontally, whereas in the gnuplot case (or matlab) the legend has a fixed distance to the left axis, in the qt toolkit it seems to be located at a certain fraction along the x-axis. See attached DataAspectRatio_notset_legend.png.
This might be an unrelated issue.


if exist ('OCTAVE_VERSION', 'builtin');
  graphics_toolkit gnuplot;
  graphics_toolkit qt;
end
np = 11;
x = linspace(0, 10, np);
y = x + 1;

f1 = figure;
plot(x, y);
legend({'tst'}, 'location', 'northwest');
set(gca, 'DataAspectRatio', [1 1 1]);
title('DataAspectRatio set');

f2 = figure;
plot(x, y);
legend({'tst'}, 'location', 'northwest');
title('DataAspectRatio not set');
pause

print(f1, 'DataAspectRatio_set_legend.png', '-dpng');
print(f2, 'DataAspectRatio_notset_legend.png', '-dpng');



A.R. Burgers <arb>
Thu 04 Jun 2020 12:15:43 PM UTC, comment #2: 

I pushed the patch on stable:

http://hg.savannah.gnu.org/hgweb/octave/rev/8ffe43de8bfe

Marking ready for test.

Pantxo Diribarne <pantxo>
Group Member
Wed 03 Jun 2020 08:51:39 PM UTC, comment #1: 

The attached simple patch fixes the issue for me.

(file #49208)

Pantxo Diribarne <pantxo>
Group Member
Wed 03 Jun 2020 02:33:04 PM UTC, original submission:  

This script (also attached) produces a plot (png attached) with the legend outside the axes:


if exist ('OCTAVE_VERSION', 'builtin');
  graphics_toolkit gnuplot;
  graphics_toolkit qt;
end
np = 11;
x = linspace(0, 10, np);
y = x + 1;
plot(x, y);
legend({'tst'}, 'location', 'northwest');
set(gca, 'DataAspectRatio', [1 1 1]);
print('DataAspectRatio_legend.png', '-dpng');
pause


With the DataAspectRatio setting omitted, or with the gnuplot toolkit the legend is shown inside the axes. This is the case with octave 5.x, 6.x and 7.x.

A.R. Burgers <arb>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #49211:  bug58492-2.patch added by pantxo (1KiB - text/x-patch)
file #49208:  bug58492.patch added by pantxo (1KiB - text/x-patch)
file #49206:  DataAspectRatio_legend.png added by arb (14KiB - image/png)
file #49207:  DataAspectRatio_legend.m added by arb (284B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by arb (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-06-05 pantxo StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-06-04 pantxo Attached File- Added bug58492-2.patch, #49211
    2020-06-04 arb Attached File- Added DataAspectRatio_notset_legend.png, #49210
    2020-06-04 pantxo StatusPatch Submitted Ready For Test
    2020-06-03 pantxo Attached File- Added bug58492.patch, #49208
        StatusNone Patch Submitted
    2020-06-03 arb Attached File- Added DataAspectRatio_legend.png, #49206
        Attached File- Added DataAspectRatio_legend.m, #49207

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code