Descending Axis Meshgrid Plotting
2 views (last 30 days)
Show older comments
[EDIT: 20110512 16:59 - reformat - WDR]
Dear fellow MATLAB Users,
I am plotting data over a meshgrid, and would like to reverse the plotted "Y" axis from ascending to descending. For some reason, when changing my meshgrid parameters to allow for this, I am prompted with a 1x1 plotting window. Here is my code as it stands before making my alteration:
__________ CODE START __________
z=zeros(1,12);
xD=[1600;1666;1730;1780;1810;1800;1780;1770;1740;1720;1670;1610];
yD=[700;730;790;860;980;1030;1020;1100;1070;1030;970;930];
[x,y] = meshgrid(487:4:2074, 213:4:1106);
z_sum = 0*x;
h = surf(x,y,z_sum,'linestyle','none');
axis image
for i=1:numel(xD);
z=550 - 4.2*sqrt((x-xD(i)).^2+(y-yD(i)).^2);
z(z<0) = 0;
z_sum = z_sum + z;
set(h,'zdata',z_sum);
view([0 90])
drawnow;
pause(.01);
end
__________ CODE END __________
This will return my desired plot, with exception to a descending "Y" axis. This is how my code appears after alterating:
__________ NEW CODE START __________
z=zeros(1,12);
xD=[1600;1666;1730;1780;1810;1800;1780;1770;1740;1720;1670;1610]; yD=[700;730;790;860;980;1030;1020;1100;1070;1030;970;930];
[x,y] = meshgrid(487:4:2074, 1106:4:213);
z_sum = 0*x; h = surf(x,y,z_sum,'linestyle','none'); axis image
for i=1:numel(xD); z=550 - 4.2*sqrt((x-xD(i)).^2+(y-yD(i)).^2); z(z<0) = 0; z_sum = z_sum + z; set(h,'zdata',z_sum); view([0 90]) drawnow; pause(.01); end
__________ NEW CODE END __________
Notice how a 1x1 unit plot is created. I cannot understand why this is occurring, nor what to do to remedy it. Any help that could be lent to solve this issue would be greatly appreciated.
Thank you,
~ Chris
1 Comment
Asawari
on 18 Oct 2013
Hi.I am facing the same problem.I am applying mesh command and I want to arrange the axes in descending order instead of ascending.If you have got the answer can you please help me out also?
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!