bugGNU Octave - Bugs: bug #32311, text command differs between...


bug #32311: text command differs between graphics_tookits

Submitted by:  Michael Godfrey <godfrey>
Submitted on:  Mon 31 Jan 2011 10:41:13 PM UTC  
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Michael Godfrey Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

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)

Tue 19 Mar 2013 10:01:09 PM UTC, comment #9: 

I'm closing this report since the original issue of text() command compatibility with Matlab seems to have been achieved.  There is another problem in this report about the use of the axis command.  I have opened a new report specifically for that issue under bug #38553.

Rik <rik5>
Project Administrator
Tue 12 Mar 2013 10:18:46 PM UTC, comment #8: 

It appears that most of the problems reported in this 2-year old report have been fixed.

1) Default 'clipping' for text objects is now off.
2) Text objects outside the axes do not force an axis rescale.
3) labels are correctly positioned after axis()

Can this be closed now?

Rik <rik5>
Project Administrator
Mon 07 Feb 2011 09:41:37 PM UTC, comment #7: 

One more result:  using fltk and default clipping
'off' all that is needed to cause the labels to
appear correctly is to switch focus to the plot
window.  So, this problem should not be so hard to fix.
I hope !!

Michael Godfrey <godfrey>
Project Member
Mon 07 Feb 2011 09:35:35 PM UTC, comment #6: 

Just tried the sequence shown below
using gnuplot and default clipping 'off'

It works as expected, and the data do not extend
outside the axes.

And, Matlab R2009b behaves the same as

Using fltk I do not mind the data extending outside
the axes, but the mispositioning of the labels
definitely needs fixing.

Michael Godfrey <godfrey>
Project Member
Mon 07 Feb 2011 09:00:55 PM UTC, comment #5: 

As an addition to my previous comment,
there are more problems with the positioning
of x,y, and z labels.  While experimenting
with the positioning of text() strings I
found that the x,y, and z label strings do not
maintain their correct positions relative to
the axes when axis() is used to change the axes.
Here is a simple example (with default clipping 'off')
but it also fails using a current tip with default
clipping 'on':

octave:1> plot(1:200)
octave:2> xlabel ('x label')
octave:3> ylabel ('y label')
octave:4> title('title')
octave:5> axis([50 100 50 150])
octave:6> axis([-50 300 -50 250])

For some reason the ylabel was moved correctly
but not the xlabel.  In a more complicated test
the zlabel ended up wrong.

It does not appear that default clipping 'off'
changes the behavior with respect to axis
and title strings.  But, I did notice
one behavior with default clipping off:  if one
shrinks the axes, the drawn data extends
outside the axes.  I have not checked Matlab
on this, but it could be that including the
drawn data outide the axes if clipping 'off'
is useful.

The definite error is not tying the axis labels to
the axes, whether clipping is 'on' or 'off'.

Michael Godfrey <godfrey>
Project Member
Mon 07 Feb 2011 07:39:55 PM UTC, comment #4: 

This change has revealed another problem.
Using text with arguments outside the axes
causes the axes to be changed to include
the text origin point.  This is not consistent
with Matlab and not what should happen.

So, I think that the changeset below is OK,
but with or without it, the axis change needs
to be removed.

Michael Godfrey <godfrey>
Project Member
Mon 07 Feb 2011 07:06:25 PM UTC, comment #3: 

The attached changeset sets the default
clipping "off"

This is consistent with Matlab and seems
better than "on."  However, there does not
seem to be a way of resetting the "default"
clipping, or does someone know how?

In any case, I prefer the default "off"

(file #22618)

Michael Godfrey <godfrey>
Project Member
Thu 03 Feb 2011 07:00:29 AM UTC, comment #2: 

I just checked Matlab (R2009a) and it allows text
commands with origins nearly anywhere in the
window.  This seems pretty exact on the left
margin, less so on the right and top and bottom.
If the text extends off the edge od the window, it
shows as much as fits.

In this case good to follow Matlab, except for
being somewhat more precise.

Michael Godfrey <godfrey>
Project Member
Thu 03 Feb 2011 06:25:59 AM UTC, comment #1: 

I think the behavior of Octave with the fltk graphics toolkit is the same as Matlab.

I'm not sure what the correct behavior is, or whether Matlab's behavior is documented anywhere.

In 3.2.4, the behavior seems wrong in that if I do

  line  ## axis limits are now both 0 to 1
  text (2, 2, 'foo')

the line disappears and the text appears in the plot window.  With

  text (0.5, 0.5, 'foo')

the line remains, but the axes limits change to something smaller.

If you think about the text function as a way to annotate an existing plot, then the Matlab behavior makes some sense.  But Matlab does seem to have the additional restriction of omitting any text objects outside the axes.

John W. Eaton <jwe>
Project Administrator
Mon 31 Jan 2011 10:41:13 PM UTC, original submission:  

In previous Octave versions (using gnuplot)
text(x,y,'text') displayed the text even if
(x,y) was not within the current axes or
display area.  If the (x,y) was outside, the
axes were rescaled.

Now for gnuplot:
the text is displayed if (x,y) is within the
display area. The axes are not changed.  Exactly
how far outside the axes is allowed is not clear.
Roughly up to the positions of the title, xlabel and
ylabel text works.

For fltk;
text only displays if (x,y) is within the axes.
If a text command is given with coordinates outside
the axes it is not displayed.  If the axes are
expanded to include the (x,y) position of the text
then the text appears.

It would seem better to allow text to display if
its (x,y) is within the area including the title,
xlabel, and ylabel positions. It appears that
gnuplot does this.  fltk requires a change.

I would say that the old (3.2.4) gnuplot behavior
should not be continued.  But, there could be a
compatibility argument here.


Michael Godfrey <godfrey>
Project Member


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

Attach Files:

Attached Files
file #22618:  changeset-clipping.diff added by godfrey (776B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by godfrey (Submitted the item)

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

    Only project members can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-03-19 rik5 StatusNone => Fixed
        Open/ClosedOpen => Closed
    2011-02-07 godfrey Attached File- => Added changeset-clipping.diff, #22618

    Back to the top

    Powered by Savane 3.5