bugGNU Octave - Bugs: bug #49621, Custom yticklabels lead to wrongly...

 
 

bug #49621: Custom yticklabels lead to wrongly placed annotations when figure is maximized

Submitter:  None
Submitted:  Wed 16 Nov 2016 01:16:28 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Dmitry Volosnykh Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.0.2
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 21 Nov 2016 01:50:52 PM UTC, comment #4: 

@Dmitry:

  • comment #2: the answer is yes but you have to do it yourself (ML doesn't provide such option builtin, neither does Octave). You may want to look at "demo annotation 6" for how to map annotation coordinates to axes coordinates. Then you'll have to use "addlistener" function to change your annotation position when either the figure or the axes "position" property changes
  • comment #3: I meant that this is how it works in ML and in Octave. Now I don't pretend that this is simple to understand when you don't understand the background as much as I do. Could you suggest an improvement of the documentation to make it clear that annotation an axes coordinate systems are different and that one should not expect annotations and axes objects to stay aligned on figure/axes size changes?


Pantxo Diribarne <pantxo>
Group Member
Mon 21 Nov 2016 01:02:50 PM UTC, comment #3: 

@Pantxo Saying 'all you observe is expected' do you mean that such behavior is expected from the perspective of the developer or from user's point of view. As for me, it was totally unexpected.

Dmitry Volosnykh <dvolosnykh>
Mon 21 Nov 2016 12:57:52 PM UTC, comment #2: 

Is there any way to bind annotations objects positions to axes position so that calculations are re-evaluated?

Dmitry Volosnykh <dvolosnykh>
Wed 16 Nov 2016 02:31:36 PM UTC, comment #1: 

Hi,

The axes position is in "normalized" units by default, as are default annotation objects. Default ticklabels are sufficiently small to not force the axes extent to be shrink. That is why maximizing does not break the annotation alignment with default labels.

Now your custom labels are too large to fit in the available space when the figure has its default size and maximizing the figure thus changes the axes position:


hf = figure ();
plot (1:10)
printf ("Default axes position: %s", disp (get (gca, "position")))
labels = get (gca, "yticklabel");
labels{1} = "AAAAAAAAAAAA";
set (gca, "yticklabel", labels);
printf ("Modified axes position: %s", disp (get (gca, "position")))
set (gcf, "position", [0 0 600 600])
printf ("Maximized axes position: %s", disp (get (gca, "position")))


The annotations objects position is independent of the axes position so all you observe is expected.

Closing report as invalid.


Pantxo Diribarne <pantxo>
Group Member
Wed 16 Nov 2016 01:16:28 PM UTC, original submission:  

When default yticklabels are used annotations are drawn correctly either in normal or maximized window.
Alas, with custom yticklabels annotations are draw correctly in normal window only. After window gets maximized annotations' positions are wrongly calculated.

See attached screenshots.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38990:  default_labels_normal.png added by None (31KiB - image/png)
file #38991:  custom_labels_normal.png added by None (33KiB - image/png)
file #38992:  default_labels_maximized.png added by None (50KiB - image/png)
file #38993:  custom_labels_maximized.png added by None (54KiB - 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 dvolosnykh (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by None (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-16 pantxo StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
    2016-11-16 None Attached File- Added default_labels_normal.png, #38990
        Attached File- Added custom_labels_normal.png, #38991
        Attached File- Added default_labels_maximized.png, #38992
        Attached File- Added custom_labels_maximized.png, #38993

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code