octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Behavior of hold all and subplot


From: Michael Godfrey
Subject: Behavior of hold all and subplot
Date: Mon, 10 Aug 2015 15:32:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

This should be mainly a documentation item. But, I thought it would
be useful for anyone with an interest to comment on the following:

1. Current documentation says that hold all unconditionally "holds"
    the current plot so that new commands add to the current plot. This
    suggests  that hold all is different from hold on.
2. However, this is not true for subplots in both Octave and Matlab.
    If:
   hold all
   subplot(2,2,1)
   plot(0:1)    %% line color blue
   subplot(2,2,2)
   plot(0:1)    
   plot(1:-1:0)
   hold on     %% without this, previous data erased in both Matlab and Octave.
   plot(0:1)   %% line color red for Matlab, blue for Octave

an additional hold on/all is needed after each subplot() call. Otherwise
previous data in the subplot is cleared.

So, for Matlab compatibility the hold behavior should be left as is, but
documented.

It would probably be appropriate to improve Matlab compatibility by
implementing the color change for subsequent data plots with hold on/all.

If people think that this lack of Matlab compatibility is important, a bug
report should be filled.

In any case, the Manual should be changed to reflect the current behavior unless
anyone thinks that the behavior should be changed. It would seem more natural
to make hold on/all do an unconditional hold for plots or subplots (i.e. it "holds"
the figure). But, this would mean a significant incompatibility with respect to Matlab.

Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]