bugGNU Octave - Bugs: bug #52186, Adding an annotation also adds a...


bug #52186: Adding an annotation also adds a black border around figure

Submitter:  Etienne Dechamps <edechamps>
Submitted:  Sat 07 Oct 2017 09:05:18 PM UTC
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sun 15 Oct 2017 12:39:10 AM UTC, comment #5: 

I verified the fix for bug #52170 resolves this bug as well.  Fixed on the development branch.

Rik <rik5>
Group administrator
Sat 14 Oct 2017 11:22:47 PM UTC, comment #4: 

I've added a patch to bug report 52170


that addresses this scenario as well as the case of placing multiple axes on the same plot.  The issue is that arrows, just like labels, are persistent in gnuplot so need to be cleared between plots and multiplots.

Dan Sebald <sebald>
Sat 14 Oct 2017 10:24:33 PM UTC, comment #3: 

Confirmed with a recent development tip (10/14/17).  Adding Dan to the CC list for this bug.  This is probably a consequence of the fact that the annotation object is implemented in a new axes object.

Rik <rik5>
Group administrator
Sun 08 Oct 2017 12:24:53 PM UTC, comment #2: 

Intriguingly, the 'xcolor' and 'ycolor' properties of the axes object have an effect on the color of the spurious border:

set(gca(), 'xcolor', [1 0 0])
set(gca(), 'ycolor', [0 1 0])

These will change the color of the axes and the spurious border around the figure at the same time. Seems like there is something wrong with the gnuplot axes properties that Octave generates.

One workaround could be to set these colors to white, but of course that's not practical, because then the actual axes themselves become white.

A more intricate workaround is to create a new dummy axes object that we can set to white:

dummy_axes = axes();
set(dummy_axes, 'color', 'none');
set(dummy_axes, 'box', 'on');
set(dummy_axes, 'xcolor', 'white');
set(dummy_axes, 'ycolor', 'white');
set(dummy_axes, 'xtick', [])
set(dummy_axes, 'ytick', [])

This seems to be effective at removing the spurious border.

Etienne Dechamps <edechamps>
Sun 08 Oct 2017 09:44:31 AM UTC, comment #1: 

After dumping the gnuplot script using the debug version of drawnow() and experimenting with it, I noticed that the following gnuplot commands are generated if an annotation is present:

set tmargin screen 1;
set bmargin screen 0;
set lmargin screen 0;
set rmargin screen 1;

Commenting out these lines makes the border disappear. Seems like Octave should not be generating these commands.

Etienne Dechamps <edechamps>
Sat 07 Oct 2017 09:05:18 PM UTC, original submission:  

On Debian Sid, octave 4.2.1-4+b1, gnuplot 5.0.7+dfsg1-1:

octave:1> graphics_toolkit('gnuplot');
octave:2> fplot(@(x) sin(x), [0, pi*4]);
octave:3> annotation('arrow', [0.4 0.6], [0.4 0.6]);

As soon as the third command (annotation) is entered, in addition to the annotation itself, a 1-pixel black border suddenly appears around the entire figure for no apparent reason. The border appears when outputting to a window and when print()'ing to an image file.

This only occurs when using the gnuplot toolkit.

Etienne Dechamps <edechamps>


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by edechamps (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-10-15 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2017-10-14 rik5 Carbon-Copy- Added sebald

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code