MATLAB Movie Error: Getting Rid of Additional Axis Label

4 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 11 Dez. 2022
Change
figure(2); hold on;
to
figure(2); axis off; hold on;
  3 Kommentare
Walter Roberson
Walter Roberson am 11 Dez. 2022
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 am 11 Dez. 2022
Thank you for your help!
I found the following function to be helpful, and integrable with the code that I have.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by