Copying axes into Figure only copies the half of the actual plot.

조회 수: 3 (최근 30일)
I'm trying to copy the plot from my GUI axes into another figure then saving it as a JPEG file, but the copying of the object only copies half way of the plot.
See image attached. (Left is the copied plot from axes1 in GUI, right is the axes1 in the actual GUI.
Here is the code I'm using to copy the objects.
plot1name = ['Plot1' '.jpeg'];
h = findobj(gcf,'type','axes');
fig1 = figure('Visible','on');
newAxe1 = copyobj(h,fig1);
saveas(fig1,plot1name);
  댓글 수: 2
Voss
Voss 2020년 6월 29일
The GUI figure is bigger (in particular, taller) than Figure 1, so that may be the reason. It depends on the Units and Position properties of the axes.
Luis Garcia Maldonado
Luis Garcia Maldonado 2020년 6월 29일
Thank you, that was it, I didnt have the correct position properties of the axes.

댓글을 달려면 로그인하십시오.

채택된 답변

Adam Danz
Adam Danz 2020년 6월 29일
In addition to copying the axis children, copy the axis properties, too, especially the axis limits.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by