bugGNU Octave - Bugs: bug #49400, Document that plot() ignores...

 
 

bug #49400: Document that plot() ignores "defaultaxesbox" property

Submitted by:  Martin Kunz <mkunz>
Submitted on:  Fri 21 Oct 2016 07:44:42 AM UTC  
 
Category:  Documentation Severity:  2 - Minor
Priority:  3 - Low Item Group:  Documentation
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  4.2.0 Operating 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)

Fri 07 Sep 2018 04:09:35 PM UTC, comment #7: 

@Pantxo: I pushed your documentation change to the stable branch here (https://hg.savannah.gnu.org/hgweb/octave/rev/c3c9c8533a86).  Very minor changes like "2-D" instead of "2D", "etc." instead of "etc".

Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Fri 07 Sep 2018 01:34:45 PM UTC, comment #6: 

I attached a patch for the documenting that high level functions reset and redefine axes properties. Can someone reread this before I push it?

(file #44953)

Pantxo Diribarne <pantxo>
Project Member
Mon 28 Aug 2017 08:39:14 PM UTC, comment #5: 

Posted to the mailing list but not the bug tracker:

Hi Pantxo,

Thanks for the explanation. The MATLAB behaviour seems strange to me,
but I see that doing the same in Octave is the right choice from a
compatibility point of view.

However, plot() ignoring a default box "off" is quite surprising for the
user. The way I discovered it was that

figure()
plot(1:10)

and

figure()
hold on
plot(1:10)
hold off

produced different results.
Would you mind adding a note to the help of plot() that tells the user
about this feature? Some users will not even be aware of the "box"
property, so mentioning it enables those users to get consistent plot
appearance.

John W. Eaton <jwe>
Project Administrator
Mon 24 Oct 2016 04:09:14 PM UTC, comment #4: 

Hi Pantxo,

I agree that the paragraph just before the "newplot" documentation would be a valid choice for putting an additional explanation. However, facing the unexpected result from two plot commands from comment #2, I would not search there. How about adding two sentences to 15.3.5, 'Managing Default Properties'? Below is a first draft with the new bits in the middle paragraph.

"[...]The line in the second figure window is red because it inherits its color from the global root figure parent object.

_For compatibility with MATLAB, high level functions like plot ignore "defaultaxesbox" when creating a new axis and set the "box" property to "on". Consider these examples:
[Examples from comment #2, nicely formatted]
If the box around axes is off by default, the two figures will look different as "hold on" creates a default axis while "plot" does not._

   To remove a user-defined default setting, set the default property to the value "remove".[...]"

If you find the suggestion with example too lengthy, we could just use the first sentence.
I don't know how many other default properties are ignored by "plot" and the like, is it possible to include a complete list at this point in the documentation?

Martin Kunz <mkunz>
Sat 22 Oct 2016 11:42:17 AM UTC, comment #3: 

I can confirm Matlab and Octave behave the same way when "hold on" is used prior to any plot (see "hold" demos here http://josoansi.de/octave_plot_compare/compare_plot_demos_03.html).

I think the best place to document this surprising but intended behavior is in the manual, in the paragraph just before the "newplot" documentation, in which the behavior of high level plotting functions is explained.
Martin, can you propose a modification of the paragraph? (run "doc('newplot')" and look at the previous paragraph)

Reopening the bug report and changing its title and tags to describe the remaining (documentation) issue.

Pantxo Diribarne <pantxo>
Project Member
Fri 21 Oct 2016 02:34:14 PM UTC, comment #2: 

@Martin: don't reply from your mail client or your answers are not visible in the bug tracker. Pasting here your answer.

--------------------------------------------------
Martin wrote:
Thanks for the explanation. The MATLAB behaviour seems strange to me,
but I see that doing the same in Octave is the right choice from a
compatibility point of view.

However, plot() ignoring a default box "off" is quite surprising for the
user. The way I discovered it was that

figure()
plot(1:10)

and

figure()
hold on
plot(1:10)
hold off

produced different results.
Would you mind adding a note to the help of plot() that tells the user
about this feature? Some users will not even be aware of the "box"
property, so mentioning it enables those users to get consistent plot
appearance.
---------------------------------------------------------

I'd say that this is expected (but would probably be worth a test in ML): when using "hold on" prior to plot, you create a default axes (as none was existing) and retain it for further plots (its "nextplot" property is set to "add").

As for documenting that high level plotting functions sometimes (often) override defaults (for the main object and for its parent axes), what would you propose since not only "plot" but many other function do that?

Pantxo Diribarne <pantxo>
Project Member
Fri 21 Oct 2016 07:55:53 AM UTC, comment #1: 

Hi,

The box is set to "on" by the highlevel "plot" function. This is consistent with Matlab (see demos for "plot" functionhttp://josoansi.de/octave_plot_compare/compare_plot_demos_05.html).

Previously in 4.0.x, the default was "on" so plot didn't have to force it, hence the result you see in 4.0.3. Now that we have the default "off", for ML compatibility, plot has to force it, also for ML compatibility.

Closing report as invalid.

Pantxo Diribarne <pantxo>
Project Member
Fri 21 Oct 2016 07:44:42 AM UTC, original submission:  

The following code

set (0, "defaultaxesbox", "off")
figure ()
axes
get (gca, "box")

figure ()
plot ([])
get (gca, "box")

produces one figure that has borders just to the left and to the right and one with a box around the plot area. I get the following output:

ans = off
ans = on

So apparently plot ignores "defaultaxesbox" and just sets "box" for the current figure to "on".

In 4.0.3 I get two plots without box and the output

ans = off
ans = off

Martin Kunz <mkunz>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #44953:  docaxes.patch added by pantxo (7KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by mkunz (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 15 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-09-07 rik5 StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2018-09-07 pantxo Attached File- => Added docaxes.patch, #44953
        StatusConfirmed => Patch Submitted
    2016-11-17 mtmiller Release4.2.0-rc2 => 4.2.0
    2016-11-16 rik5 Severity3 - Normal => 2 - Minor
        Priority5 - Normal => 3 - Low
    2016-10-22 pantxo CategoryPlotting with OpenGL => Documentation
        Item GroupRegression => Documentation
        StatusInvalid => Confirmed
        Open/ClosedClosed => Open
        Operating SystemMicrosoft Windows => Any
        Summaryplot() ignores "defaultaxesbox" property => Document that plot() ignores "defaultaxesbox" property
    2016-10-21 pantxo StatusNone => Invalid
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.5