Text keeps going behind topographic map

조회 수: 1 (최근 30일)
Zara Conti
Zara Conti 2020년 3월 29일
댓글: David Wilson 2020년 3월 30일
Hi I've used all the stuff below but my plotted text is always behind the land mass, I can see the last few letters of the sentence poking out of the island so i can see its plotted, how do i get the text to be infront?
surfl
colormap gray
shading interp
view(0,90)
hold on
plot(long, lat);
text(long,lat,'text');

채택된 답변

David Wilson
David Wilson 2020년 3월 29일
편집: David Wilson 2020년 3월 29일
Your mountains are covering the text (as they should). So you need to write your text above the highest peak, so that it is seen. Use text(x,y,z,'My text here), and make sure the "z" value is high enough, i.e. bigger than the immediate ground under the text.
[X,Y,Z] = peaks(30);
surfl(X,Y,Z)
colormap gray
shading interp
view(0,90)
hold on
longLow = -1; latLow = 0.5; % will be partially covered
longHi = 0; latHi = 1.5; % will be totally covered
plot(longLow, latLow);
h1 = text(longLow,latLow,11,'textLo'); % altitude of z=11 is above highest mountain
h2 = text(longHi,latHi,11,'textHi');
hold off
  댓글 수: 2
Zara Conti
Zara Conti 2020년 3월 29일
Hi, When i used your code it made my map very fuzzy.
So i did the plot(lon,lat,z) and text(lon,lat,z) and made the z value above any height values on the map
and this came up:
Data must be a single matrix Y or a list of pairs X,Y.
Error in assessednmap (line 19)
plot(-91.4,-0.45,1700);
I just want to be able to label points on my map
David Wilson
David Wilson 2020년 3월 30일
You need to use plot3 (for 3D), not just plain plot.m (Note the 3 in the "plot3" name.)
plot3(-91.4,-0.45,1700); % make sure you include the "3"

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by