MATLAB Movie Error: Getting Rid of Additional Axis Label

4 ビュー (過去 30 日間)
Thomas Rodriguez
Thomas Rodriguez 2022 年 12 月 11 日
コメント済み: Thomas Rodriguez 2022 年 12 月 11 日
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.

採用された回答

Walter Roberson
Walter Roberson 2022 年 12 月 11 日
Change
figure(2); hold on;
to
figure(2); axis off; hold on;
  3 件のコメント
Walter Roberson
Walter Roberson 2022 年 12 月 11 日
You have two issues:
  1. 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
  2. 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.
Thomas Rodriguez
Thomas Rodriguez 2022 年 12 月 11 日
Thank you for your help!
I found the following function to be helpful, and integrable with the code that I have.

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

その他の回答 (0 件)

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by