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