bugGNU Octave - Bugs: bug #49446, Graphics objects (esp. legends)...


bug #49446: Graphics objects (esp. legends) should be manipulated/dragged with the mouse

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Wed 26 Oct 2016 09:36:54 AM UTC  
Category: PlottingSeverity: 1 - Wish
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: NoneAssigned to: None
Originator Name: Philip NienhuisOpen/Closed: Open
Release: devOperating System: Any

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 Jump to the original submission)

Fri 22 Dec 2017 06:15:15 PM UTC, comment #7:

At least for FLTK, it is possible to click on a legend object and move it around. This is very useful for getting the best position. The code for this is in _init_fltk_.cc. Maybe something like it can be borrowed and put in the Qt mouse button 1 handling routine.

Rik <rik5>
Project Administrator
Mon 05 Dec 2016 12:38:35 PM UTC, comment #6:

figure ()
%% ST inactive:
plot (1:10)
get (gcf, 'currentobject')
%% Left Click on the axes: what happens?

get (gcf, 'currentobject') == gca

%% Righ Click on the axes: what happens?


get (gcf, 'currentobject') == gca

%% Check the SL and left click on the axes: what happens? Do handles appear around the axes ...?

(I suppose SelectionTool = button "Edit plot" = the white arrow button)
Clicking that shows a handle grid around the entire plot (editplot-1.png).
Clicking the axes then moves those handles to the plot lines (editplot-2.png)

%% Uncheck the ST: what happens?

The handle grid disappears.

(file #39147, file #39148)

Philip Nienhuis <philipnienhuis>
Project Member
Mon 28 Nov 2016 09:46:23 PM UTC, comment #5:


Hopefully Thursday I'll have time to check with Matlab.

Selection works easy in Matlab (at least for legends):
simply left-click on the legend and drag it around with LMB pressed.

Philip Nienhuis <philipnienhuis>
Project Member
Wed 23 Nov 2016 02:52:18 PM UTC, comment #4:

@Philip: could you describe how the selection tool works in ML. I know the question is vague but having a few info would help implementing this tool in Octave.

For example does the Selection Tool (ST) have to be toggled to be able to change the current object of a figure? Test

Pantxo Diribarne <pantxo>
Project Member
Wed 26 Oct 2016 03:46:00 PM UTC, comment #3:

Here is an ugly workaround for moving legends with mouse:

Pantxo Diribarne <pantxo>
Project Member
Wed 26 Oct 2016 02:40:05 PM UTC, comment #2:

(I did search for similar reports but it didn't occur to me that "legend changes position" would be duplicates as well.)

You suggestion to change title is a good one. I'll change the status to "none' then, OK?

Philip Nienhuis <philipnienhuis>
Project Member
Wed 26 Oct 2016 10:37:37 AM UTC, comment #1:

Hi Philip,

The legend has "normalized" units and no listener on the figure/axes position, hence the magnification you observe when increasing the figure size. This is a known bug: see bug #39697 and bug #40333.
Now about moving the legend I think it is possible:

Can I close this report as a duplicate of cited reports, or would you prefer to keep this report and make the main issue be "graphics objects can be manipulated/dragged with the moue"?

Pantxo Diribarne <pantxo>
Project Member
Wed 26 Oct 2016 09:36:54 AM UTC, original submission:

(See attached pic for a comparison between Matlab (2014a) and Octave, both in one picture)

In Matlab, when a plot windows with a legend is resized / stretched using the mouse, the legends move with the plot area proper but aren't stretched with/like the plot area itself.
In Octave, the legend box is stretched as well, in proportion to the plot window (while the contents seem to remain untouched as regards size).
This applies to both horizontal and vertical resizing of plot windows.

In addition, in Matlab one can freely drag the legend box around in the plot window as a separate entity. In Octave the legend is fixed to its position.
In the attached pic I've dragged the legend in the Matlab subpicture from left to the right and a little below, just to show what I mean.

I suppose one of the reasons that legends in Matlab aren't stretched/resized together with plot windows is just because they seem to be independent entities.

Philip Nienhuis <philipnienhuis>
Project Member


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

Attach File(s):

Attached Files
file #39147:  editplot-1.png added by philipnienhuis (16KiB - image/png)
file #39148:  editplot-2.png added by philipnienhuis (18KiB - image/png)
file #38815:  MLvsOct_plot.png added by philipnienhuis (148KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by pantxo (Posted a comment)
  • -unavailable- added by philipnienhuis (Submitted the item)

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

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 05 Dec 2016 05:07:19 PM UTCrik5Carbon-CopyRemoved 72865=>-
    Mon 05 Dec 2016 12:38:35 PM UTCphilipnienhuisAttached File-=>Added editplot-1.png, #39147
      Attached File-=>Added editplot-2.png, #39148
    Wed 16 Nov 2016 06:39:04 PM UTCrik5Severity3 - Normal=>1 - Wish
    Wed 26 Oct 2016 02:40:05 PM UTCphilipnienhuisStatusDuplicate=>None
      SummaryLegends shoudn't be resized together with plot window, and be movable independently=>Graphics objects (esp. legends) should be manipulated/dragged with the mouse
    Wed 26 Oct 2016 10:37:37 AM UTCpantxoStatusNone=>Duplicate
    Wed 26 Oct 2016 09:36:54 AM UTCphilipnienhuisAttached File-=>Added MLvsOct_plot.png, #38815

    Back to the top

    Powered by Savane 3.1-cleanup1