MATLAB Movie Error: Getting Rid of Additional Axis Label
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Thomas Rodriguez
am 11 Dez. 2022
Kommentiert: Thomas Rodriguez
am 11 Dez. 2022
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 11 Dez. 2022
Change
figure(2); hold on;
to
figure(2); axis off; hold on;
3 Kommentare
Walter Roberson
am 11 Dez. 2022
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.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!