MATLAB Movie Error: Getting Rid of Additional Axis Label
4 次查看(过去 30 天)
显示 更早的评论
I'm trying to use the following MATLAB example, but my movie plot looks very strange.
Here's the following code:
clc; clear; close all;
for k = 1:16
[f1] = Plot_F1(k);
M(k) = getframe(f1);
end
figure(2); hold on;
movie(M,5)
hold off;
function [f1] = Plot_F1(k)
f1 = figure(1);
%hold on; grid on; box on;
plot(fft(eye(k+16))); hold on;
title(['Iters = ' num2str(k)])
axis equal;
hold off;
end
The reason that I made a plot function because (in my other code) I did some computations and plotted the results within a different function and solving iteratively similarily to the above example. So, I don't want to change that as much.
The issue that it creates for the Movie figure is:
1) Q: Is there a way to get rid of the "additional" axis values in the plot above?
I've tried
clf(f1)
but that was no help at all.
Another couple questions have are:
2) Is there a way to speed up the movie image?
3) Is it possible to have the movie image display a title that shows the iterations at each image? Similar to what I did in the function + for loop.
Thank you for your help.
0 个评论
采纳的回答
Walter Roberson
2022-12-11
Change
figure(2); hold on;
to
figure(2); axis off; hold on;
3 个评论
Walter Roberson
2022-12-11
You have two issues:
- When the original image is generated, the drawing area ("InnerPosition") is typically not centered in the figure, because of the space left for the axes labels and titles, which is something that happens only on one side and not on the other
- When the captured image is displayed, again the drawing area might not be centered because of space left for labels and titles
Have you considered capturing the drawing area instead of the figure? exportgraphics to write to file, imread() and insert into a movie. Or perhaps exportgraphics to a .GIF with 'append' set to create an animated gif.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!