How to plot one column in a martix
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
jonas
am 26 Feb. 2018
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!