Why does my plot shrink?
11 views (last 30 days)
Show older comments
Hi,
I was wondering if any may be able to help? My plot keeps shrinking when the FOR loop has finished.
It should look like this,
and does whilst it is updated from the FOR loop, but as soon as the loop has finished it looks like this
The code for the imagesc plot is as follows:
within the app
% Define axis to plot
axis(app.UIAxes,'image');
app.ax = app.UIAxes;
% Call function FDTD
[app.E2,app.V2] = fdtd_time_reversal(app.X, app.Y, app.del, app.dt, app.send, app.arraystart, app.elements, app.receiver , 1, 1, -app.depth, app.offset + app.depth, app.media, app.er, app.ax);
imagesc(app.UIAxes,app.E2)
axis(app.UIAxes, 'image')
xlim(app.UIAxes, 'tight')
ylim(app.UIAxes, 'tight')
drawnow
and within the function, where a call is made to another function first.
% Advance the fields using code 'fdtd_andy'
[ezx,ezy,hx,hy] = fdtd_andy(ezx,ezy,hx,hy,alphaex,alphaey,alphamx,alphamy,betaex,betaey,betamx,betamy);
%The extra layers from the boundary conditions are removed
E=(ezx+ezy);
[a,b] = size(E);
E = E(33:(a-32), 33:(b-32));
E1=E;
E2=E;
colormap(ax, jet)
% mesh(ax, E)
imagesc(ax, E)
caxis(ax, [-100 100])
axis(ax,'image')
xlim(ax, 'tight')
ylim(ax, 'tight')
drawnow % This command will tell MATLAB to draw this frame before moving on
Hoping someone may know.
Kind regards,
Andy
1 Comment
Chunru
on 28 Feb 2024
You may want to try the following (or combinations of them):
axis(ax, "ij")
axis(ax, "normal")
Accepted Answer
More Answers (1)
See Also
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!