contour plot based on xyz data
Show older comments
I have xyz data as attached. X is longitude, y is altitude and z is electron density. For each value of longitude from 75 to 95, I have altitude values of 100 to 2000 with corresponding electron density values for each altitude. I want a colored contour plot with these data. Please help.
Accepted Answer
More Answers (1)
You just need to interpolate gridded data.
xyz=dlmread('data_new.txt');
x=xyz(:,1);
y=xyz(:,2);
z=xyz(:,3);
[X,Y]=meshgrid(min(x):max(x),min(y):max(y));
Z=griddata(x,y,z,X,Y);
contour(x,y,Z)
2 Comments
youssef aider
on 25 Mar 2019
works but, still gives some fluctuations
Daniyal Altaf Baloch
on 7 Feb 2020
Hi Jonas. Your answer perfectly works except for the typo in the last line.
Instead of
contour(x,y,Z)
it should be
contour(X,Y,Z) i.e capital X and Y will work .
Categories
Find more on Contour Plots 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!

