How to plot a 2D bathymetric contour map
25 views (last 30 days)
Show older comments
I have been given a code to produce a 3D bathymetric contour map, but I have two problems;one is that the figure produced is just black and white where I would want it in colour and the other is that i want to produce a 2D plot rather than 3D.
Below is the code I have been given. Please can someone contact me and answer my queries, much appreciated.
clear all;
close all;
ln=3; ln2=6;
mk1=12; mk2=14; mk3=18; mk4=22;
load FASTNEt_cruise_bathymetry
[lon,lat]=meshgrid(lon.data,lat.data);
figure('color','white')
surf(lon,lat,z.data)
grid
onset(gca,'layer','top')
set(gca,'zlim',[-3500,0])
hold on
shading interp
colorbar
caxis([-2000,0])
set(gca,'layer','top')
set(gca,'fontsize',mk3)
[cc,ch]=contour3(lon,lat,z.data,[-200 -500 -1000 -1500 -2000],'k-');
clabel(cc,ch,[-200 -500 -1000 -1500 -2000],'fontsize',mk2,'fontweight','bold')
set(ch,'color','k')
xlabel('Longitude (^oE)','fontsize',mk3,'fontweight','bold')
ylabel('Latitude (^oN)','fontsize',mk3,'fontweight','bold')
zlabel('Depth (m)','fontsize',mk3,'fontweight','bold')
%To zoom in on detail set(gca,'xlim',[-10.5,-8.5]) set(gca,'ylim',[55.2,56.2])
0 Comments
Accepted Answer
Chad Greene
on 8 Feb 2015
First, a minor request: when posting code, format it using the "Code" button. Monospaced code is easier to read.
Regarding color: I'm not sure why the resultant map is grayscale, unless you already have a gray colormap assigned to the figure. Try following everything with colormap(jet(256)) or colormap(hot(256)) or use your favorite color map. This is a pretty good color map for bathymetric data.
For 2D view, simply follow everything with view(2).
More Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox 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!