Replicate / Duplicate 2D view: Different TightInset after reloading

조회 수: 1 (최근 30일)
Fritz
Fritz 2016년 11월 16일
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개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by