Using z values to display color in mapping toolbox?
12 次查看(过去 30 天)
显示 更早的评论
Apologies, I'm new to the mapping toolbox.
I have coordinates with associated z values that I would like to use to display color using a colormap such as redblue. However, when I feed the mapping toolbox the information all points are the same color.
h=plotm(Latitude, Longitude, z, '.', 'MarkerSize', 20)
I've checked and points do have z values (see figure). I'm sure it's an easy fix but haven't been able to find the solution anywhere. How do I use z values to display color?
Thanks a million, Kate
0 个评论
采纳的回答
Walter Roberson
2016-10-28
plotm() is not documented as accepting z values. However, it does not do error checking on any argument after the first 2 and instead just passes everything after the lat and long arguments to linem() . linem() is documented as accepting z.
If you want to pass in z, you should be using plot3m() instead of plotm()
However, neither plotm() nor plot3m() will color the line by depth. Both of them use linem() internally, and linem() uses line() internally, and any one line is restricted to being a single color.
You appear to be displaying points rather than lines. You should be using scatterm() for displaying points. scatterm accepts a color argument (lat, long, size, color) which can be set to either a matrix of RGB triples (to give exact colors for each point) or to a vector that interacts with caxis() to determine color scaling. The default for caxis is to draw the minimum value as the first color in the colormap and the maximum value as the last color in the color map and to scale linearly in-between.
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!