Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Axis equal fail matlab

Tags:

plot

matlab

I have an interesting problem in matlab. If i run the following code in a script and i run it by selecting it and pressing F9:

figure
subplot(4, 4, [1 2 5 6 9 10]);
plotGrid(spin1HGD, 2);    % A function to plot a grid, 
                          % essentially a bunch of patches. 
campos([27.8504  -39.0203   71.3373]);
axis equal

I get the following figure:

enter image description here

now if i immediately run axis equal, it actually does it:

enter image description here

Here is a screenshot of my matlab terminal:

enter image description here

So i am definitely running axis equal at the end of the script and then I am having to actually manually run it for it to work.

Annoyingly, I cant reproduce it in anything but this code? What is the deal?

like image 652
Fantastic Mr Fox Avatar asked Feb 18 '26 08:02

Fantastic Mr Fox


1 Answers

As suggested, adding drawnow before axis equal will fix this problem.

To reproduce the issue, run this code in a script:

figure
subplot(4, 4, [1 2 5 6 9 10]);
patch(rand(3), rand(3), [1 0 1])
campos([27.8504  -39.0203   71.3373]);
% drawnow 
axis equal

then type 'axis equal' in the command window and notice that the plot changes.

like image 113
Tokkot Avatar answered Feb 20 '26 20:02

Tokkot