bugGNU Octave - Bugs: bug #58649, axes labeling breaks the axis...

 
 

bug #58649: axes labeling breaks the axis position property during printing

Submitter:  vasiliy <vasiliy22>
Submitted:  Tue 23 Jun 2020 04:51:28 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug 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

Sun 25 Oct 2020 01:35:06 PM UTC, comment #12: 

I'll close this report as invalid since we did not find any bug or even define a potential feature request for improving annotation objects.

Pantxo Diribarne <pantxo>
Group Member
Thu 25 Jun 2020 01:30:32 PM UTC, comment #11: 

What should we do with this report?

IMHO it doesn't show a proper bug, only the intrinsic limitations of annotation objects.

Pantxo Diribarne <pantxo>
Group Member
Wed 24 Jun 2020 02:53:39 PM UTC, comment #10: 

I tried to set clipping to off, but it didnt help

vasiliy <vasiliy22>
Wed 24 Jun 2020 02:35:07 PM UTC, comment #9: 

Comment #8 probably involves other aspects of the graphics system.  If you are using normalized coordinates, then anything outside of the range [0,1] will not be drawn if the "Clipping" property is set to "on" (which it is by default).

Comment #7, needing to call the listener manually, is probably a different issue about how you invoked addlistener() and what the value of certain graphic properties such as "interruptible" and "busyaction" are.

I think we need a simpler example that exhibits only one problem at a time.  But, that can wait until your through your crunch period at work.

Rik <rik5>
Group administrator
Wed 24 Jun 2020 02:01:06 PM UTC, comment #8: 

What I tried is to make a callback, that recalculate the position of an annotation axes in a way to place it exactly above the figure axes. This every time the position of the figure aces changes.

The problem that I found was, that it is impossible to put an annotation if some of the coordinates is >1. The annotation is cutted out.

So the only way that was possible is to "collect" all of the coordinates and annotations handles together in some structure, and in a callback function make calculations every time to transform the real axis coordinates into a [0 0 1 1] coordinates of an annotation axis. And then set it through the property.


vasiliy <vasiliy22>
Wed 24 Jun 2020 01:52:43 PM UTC, comment #7: 

Ah, ok. I found it. The cause is that the callback function didnt called in that case. So I needed to call it manually before print

like

listener(annotations);

BTW, I found the situation very, very problematic. The workarounds are too complicated to use it in a workflow. Moreover, the functinon drawArrow from matgeom has its drawbacks and bugs too.

On the other hand graphics_toolkit gnuplot dont render correctly with or without this workaround.

So, the situation now is like it is nearly impossible to work with annotations in octave :(

vasiliy <vasiliy22>
Wed 24 Jun 2020 01:46:58 PM UTC, comment #6: 

Yes, but commenting out lines 169,170 renders the result buggy.

I'm clear about it, that my example is too complicated. I could reduce it later. Right now I am working on a project and dont want to lost the bugs. So I'm reporting it in a way they appears

vasiliy <vasiliy22>
Wed 24 Jun 2020 01:41:59 PM UTC, comment #5: 

@vasiliy: Your example is way too complicated, it would be handy if you could reduce it to something simple, as in comment #2, and explain what you think is wrong.

I tried the latest version of your script in comment #4 (had to install geometry package), printed it to .tex and compiled and I can't see anything wrong. The position of the annotation always looks correct to me both on screen and in printout.

Pantxo Diribarne <pantxo>
Group Member
Wed 24 Jun 2020 12:31:46 PM UTC, comment #4: 

So, I modified the workaround. But now it works good with labels, and dont work without labels :/

(file #49366)

vasiliy <vasiliy22>
Wed 24 Jun 2020 11:34:09 AM UTC, comment #3: 

I tried the workaround and it didnt work

vasiliy <vasiliy22>
Tue 23 Jun 2020 11:21:31 PM UTC, comment #2: 

Unfortunately, annotation objects are drawn on a separate axes so resizing figures lead to misalignment (and printing happens to involve resizing).

The reason why the misalignment is not visible onscreen is because of bug #45600. In short text takes relatively more space in printout than onscreen and this forces the axes to shrink.

Here is a simpler example that shows the effect both onscreen and in printout:


figure ("position", [50 50 300 300]);
plot (1:10)
hi = annotation ("textbox", get (gca, "position"), ...
                 "string", " Position","fitboxtotext", "off", ...
                 "linestyle", "--", "edgecolor", "b", ...
                 "linewidth", 3, "color", "b", ...
                 "verticalalignment", "bottom", "fontsize", 15);
print /tmp/before_ylabel.png
ylabel ("YLABEL", "fontsize", 40)
print /tmp/after_ylabel.png


The workaround is to add a listener on the axes position property and let it update the position of your annotations when needed. In the above example it would look like:


figure ("position", [50 50 300 300]);
plot (1:10)
hi = annotation ("textbox", get (gca, "position"), ...
                 "string", " Position","fitboxtotext", "off", ...
                 "linestyle", "--", "edgecolor", "b", ...
                 "linewidth", 3, "color", "b", ...
                 "verticalalignment", "bottom", "fontsize", 15);
addlistener (gca, "position", @(h) set (hi, "position", get (gca, "position")))
ylabel ("YLABEL", "fontsize", 40)


Pantxo Diribarne <pantxo>
Group Member
Tue 23 Jun 2020 07:12:14 PM UTC, comment #1: 

Confirmed.  Changing the Release to 6.0.90 since this is still present on the stable branch that is about to become version 6.1.  I also checked and the behavior still exists on the development branch.

Rik <rik5>
Group administrator
Tue 23 Jun 2020 04:51:28 PM UTC, original submission:  

adding some labels on axes breaks the axis position property, so some annotation results misplaced.

On the screen all apperas to be good. The misplacing appears in a printout.

I'm using qt backend with -dpdflatexstandalone driver

vasiliy <vasiliy22>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #49366:  figure3.m added by vasiliy22 (8KiB - application/vnd.wolfram.mathematica.package)
file #49361:  get_normalized_coords.m added by vasiliy22 (208B - application/vnd.wolfram.mathematica.package)
file #49357:  figure3.m added by vasiliy22 (8KiB - application/vnd.wolfram.mathematica.package)
file #49358:  figure_without_bug.pdf added by vasiliy22 (40KiB - application/pdf)
file #49359:  figure3_with_bug.m added by vasiliy22 (8KiB - application/vnd.wolfram.mathematica.package)
file #49360:  figure_with_bug.pdf added by vasiliy22 (47KiB - application/pdf)

 

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 vasiliy22 (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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-10-25 pantxo StatusConfirmed Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
    2020-06-24 vasiliy22 Attached File- Added figure3.m, #49366
    2020-06-23 rik5 StatusNone Confirmed
        Release5.2.0 6.0.90
        Summaryaxes labeling breaks the axis position property axes labeling breaks the axis position property during printing
    2020-06-23 vasiliy22 Attached File- Added get_normalized_coords.m, #49361
    2020-06-23 vasiliy22 Attached File- Added figure3.m, #49357
        Attached File- Added figure_without_bug.pdf, #49358
        Attached File- Added figure3_with_bug.m, #49359
        Attached File- Added figure_with_bug.pdf, #49360

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code