How do I set "hold all" for an array of axes handles?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Suppose I have a vector of axes handles, for instance:
ax = subplot(2,1,1);
% ...
ax(2) = subplot(2,1,2);
% ...
I would like to set "hold all" for all of them, something like:
for ii=1:length(ax),
hold(ax(ii), 'all');
end
It would be nicer to simply be able to do:
hold(ax, 'all');
where ax is a vector of axes handles. But this is specifically disallowed. In hold.m there is even the comment, "must not be a vector of handles" -- why is this?
I'm not sure whether this is a question or a feature request. (-:
0 commentaires
Réponses (2)
Jan
le 14 Juin 2011
If you look inside the source of HOLD, you see, that it is a wrapper for the command:
set(ax, 'NextPlot', 'add')
But exactly this command can be called als if ax is a vector.
HOLD('all') sets the NextPlot property of the figure also. This can be done manually also:
set(FigHandle, 'NextPlot', 'add');
3 commentaires
Jan
le 15 Juin 2011
@Walter: You are right. But I cannot see any drawbacks in omitting the SETAPPDATA call inside a real world program. AFAICS, these application data "PlotHoldStyle" are used in \sparfun\gplot.m only, but I do have a limited number of toolboxes only.
Walter Roberson
le 15 Juin 2011
The documented behavior of hold all is,
===
hold all holds the plot and the current line color and line style so that subsequent plotting commands do not reset the ColorOrder and ColorOrder property values to the beginning of the list. Plotting commands continue cycling through the predefined colors and linestyles from where the last plot stopped in the list.
===
The major use of the color order would be in plot(), which is a built-in and so not searchable for particular text strings.
Walter Roberson
le 14 Juin 2011
The code simply isn't designed to loop around to process a vector of axes.
You can define:
holds = @(ax,varargin) arrayfun(@(oneax) hold(oneax,varargin{:}), ax);
and then holds(ax, 'all') would do the task.
0 commentaires
Voir également
Catégories
En savoir plus sur Axes Appearance dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!