How to plot one column in a martix
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Rascal07
el 26 de Feb. de 2018
Respondida: jonas
el 26 de Feb. de 2018
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
Respuesta aceptada
jonas
el 26 de Feb. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!