How do I make a video of a graph with axes and axes labels?

14 ビュー (過去 30 日間)
Brian
Brian 2015 年 5 月 28 日
コメント済み: Joseph Williams 2021 年 11 月 3 日
Hi
I would like to make the video of a graph which includes the axes labels. It seems that it by default does not. Can someone help me get the whole graph with axes and axes labels in the figure. Here is an example where it does not work as intended since the axes labels are not fully shown.
close all; clear all;
writerObj = VideoWriter('peaks.avi');
writerObj.FrameRate = 5;
open(writerObj);
Z = peaks; surf(Z);
axis tight
set(gca,'nextplot','replacechildren');
set(gcf,'Renderer','zbuffer');
xlabel('x label')
ylabel('y label')
zlabel('z label')
for k = 1:20
surf(sin(2*pi*k/20)*Z,Z)
frame = getframe;
writeVideo(writerObj,frame);
end
close(writerObj);
winopen('peaks.avi')
Thanks in advance :)
  1 件のコメント
Brian
Brian 2015 年 5 月 28 日
I have just changed the title of the question.

サインインしてコメントする。

採用された回答

Brian
Brian 2015 年 5 月 29 日
Hi
I found out how to solve it. The line frame = getframe; is changed to frame = getframe(gcf);
close all; clear all;
writerObj = VideoWriter('peaks.avi');
writerObj.FrameRate = 5;
open(writerObj);
Z = peaks; surf(Z);
axis tight
set(gca,'nextplot','replacechildren');
set(gcf,'Renderer','zbuffer');
xlabel('x label')
ylabel('y label')
zlabel('z label')
for k = 1:20
surf(sin(2*pi*k/20)*Z,Z)
frame = getframe(gcf);
writeVideo(writerObj,frame);
end
close(writerObj);
winopen('peaks.avi')
  1 件のコメント
Joseph Williams
Joseph Williams 2021 年 11 月 3 日
This solution works for me as well, thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage and Video Ground Truth Labeling についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by