How to plot one column in a martix
2 次查看(过去 30 天)
显示 更早的评论
I have a matrix of elevation at each latitude and longitude. I have plotted this as a surf plot using:
ncfile = 'chagos_new.nc' ; % nc file name
% To get information about the nc file
ncinfo(ncfile);
% to display nc file
ncdisp(ncfile);
% to read a vriable 'var' exisiting in nc file
elevation = ncread(ncfile,'elevation') ;
lat = ncread(ncfile,'lat') ;
lon = ncread(ncfile,'lon') ;
figure (5)
pcolor(lat,lon,elevation)
shading interp
surf(lat,lon,elevation)
colormap jet
colorbar
shading interp
grid on
title('Chagos Archipelago')
xlabel ('Latitude (^o)')
ylabel ('Longitude (^o)')
zlabel ('Elevation from sea surface level in meters')
colorbar
h = colorbar;
set(get(h,'label'),'string','Depth (m)');
I would like to plot a east west transect of this surf plot as a line plot, possibly with the x axis being distance in km and the y axis being elevation in meters. Does anyone know how to do this? And is there a way to select my transect between two particular lat lon co-ordinates as apposed to just an entire row of a matrix? The work-space is attached, let me know if anything else is needed. Thanks
采纳的回答
jonas
2018-2-26
The gridded data is stored in the surface plot's 'ZData' property.
h=surf(lat,lon,elevation) el=get(h,'ZData') plot(lat,el(1,:))
Transforming the coordinates to distance is a bit more complicated. I believe the mapping toolbox has some functions for this.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!