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])

 채택된 답변

Chad Greene
Chad Greene 2015년 2월 8일

0 개 추천

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).
You may also consider giving your bathymetry some shaded relief with shadem.

댓글 수: 1

luke chinnock
luke chinnock 2015년 2월 9일
Thanks for the advice turns out the plot was not producing in 2D as in the code i was meant to typoe pcolor, not surf. and the map was black beacuse shading interp was in the wrong order of the cript, if that makes any sense at all!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Contour Plots에 대해 자세히 알아보기

질문:

2015년 2월 7일

편집:

2022년 2월 22일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by