I have a GUI which gets input from user and plots the step response. I want to export that graph only, not whole figure window. Can you help how to do?
조회 수: 1 (최근 30일)
이전 댓글 표시
This is the figure saved from that GUI. As you can see that it has captured the whole figure window layout, however I want to save only the plot in the figure as an image on my computer.
댓글 수: 0
답변 (1개)
awezmm
2018년 11월 2일
Can you just make a new figure window and put only the plot on that one and then export that new figure? Note that you can make the new figure invisible if you don't want the user to see it: f = figure('visible','off'); It will still be running in the background and you can programmatically export the stuff on the new figure f that only contains your plot
댓글 수: 6
awezmm
2018년 11월 6일
try putting this before you plot:
axes('Units', 'normalized', 'Position', [0 0 1 1])
again, plot on everything separately, try not to use copy.
Here is an example of the command I gave: This is normal plotting:
figure
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
This is where the plot fills everything:
figure
x = 0:pi/100:2*pi;
y = sin(x);
axes('Units', 'normalized', 'Position', [0 0 1 1])
plot(x,y)
lemme know if you have any other trouble
참고 항목
카테고리
Help Center 및 File Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!