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.
'hold all' is different from 'hold on', however Matlab is changing their behavior. 'hold all' is now deprecated and is equivalent to 'hold on'.
On the dev branch there are plans to follow suit and deprecate 'hold
all' and add the axes graphic properties 'colororderindex' and
'linestyleorderindex'.
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
'hold on' applies to an axes
object. For a figure with just one axes this is equivalent to the entire plot. But when using subplot() there are
multiple axes on a figure and you have to choose which ones you
want 'hold' to apply to. That
could be clarified in the documentation.
--Rik
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
|