Replicate / Duplicate 2D view: Different TightInset after reloading
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello
I would like to replicate a view of a plot of an image after clearing the axes with 'cla'.
Before I clear the axes I copy the properties with the below function and reload the saved properties with the same function after clearing with 'cla'.
But I cannot edit the TightInset property (read only) and that's why the view before and after 'cla' is a little bit different, because before TightInset is [78 57 4 0] and afterwards TightInset is [0 0 0 0];
Thanks in advance Fritz
function Vo = view2D(varargin)
% Set default inputs
% hAx = gca;
Vi = [];
% Parse the inputs
for a = 1:nargin
if ishandle(varargin{a})
hAx = varargin{a};
else
Vi = varargin{a};
end
end
if ~isempty(Vi)
hAx.ActivePositionProperty = Vi.ActivePositionProperty;
hAx.CameraPositionMode = 'Manual';
hAx.CameraPosition = Vi.CameraPosition;
hAx.CameraTargetMode = 'Manual';
hAx.CameraTarget = Vi.CameraTarget;
hAx.CameraUpVectorMode = 'Manual';
hAx.CameraUpVector = Vi.CameraUpVector;
hAx.CameraViewAngleMode = 'Manual';
hAx.CameraViewAngle = Vi.CameraViewAngle;
hAx.OuterPosition = Vi.OuterPosition;
hAx.PlotBoxAspectRatioMode = 'Manual';
hAx.PlotBoxAspectRatio = Vi.PlotBoxAspectRatio;
hAx.Position = Vi.Position;
hAx.Projection = Vi.Projection;
% hAx.TightInset = Vi.TightInset;
hAx.XLimMode = 'Manual';
hAx.XLim = Vi.XLim;
hAx.YLimMode = 'Manual';
hAx.YLim = Vi.YLim;
end
Vo.ActivePositionProperty = hAx.ActivePositionProperty;
Vo.CameraPosition = hAx.CameraPosition;
Vo.CameraTarget = hAx.CameraTarget;
Vo.CameraUpVector = hAx.CameraUpVector;
Vo.CameraViewAngle = hAx.CameraViewAngle;
Vo.OuterPosition = hAx.OuterPosition;
Vo.PlotBoxAspectRatio = hAx.PlotBoxAspectRatio;
Vo.Position = hAx.Position;
Vo.Projection = hAx.Projection;
Vo.TightInset = hAx.TightInset;
Vo.XLim = hAx.XLim;
Vo.YLim = hAx.YLim;
end
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Axis Labels 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!