How to make a 2-D colormap with coordinates

11 ビュー (過去 30 日間)
andres
andres 2018 年 10 月 22 日
コメント済み: andres 2018 年 10 月 25 日
Hi. I have n points, for each point I have its latitud, longitude and an indicator that take real values (from 0.5 to 2.7). I would like to make a Figure (like a colormap) that shows with colors the value of this indicator for each of these n points. Is that possible? Thanks in advance for any help.

採用された回答

andres
andres 2018 年 10 月 25 日
Finally it was better to use scatter. Thank you very much anyway!
  3 件のコメント
jonas
jonas 2018 年 10 月 25 日
That's fine! If he found a better solution then it's better to accept that one, as it may help others find the best solution in the future :)
Upon re-reading the question, I don't know why scatter was not my go-to suggestion.
andres
andres 2018 年 10 月 25 日
That is what I thought. Of course I appreciate the help (and I thanked in the original answer), but if someone has the same question in the future, it is better for him/her to know which solution was the one that worked for me better. Regards!

サインインしてコメントする。

その他の回答 (1 件)

jonas
jonas 2018 年 10 月 22 日
編集済み: jonas 2018 年 10 月 22 日
Use a surface object
surf(lon, lat, z)
The data must be gridded, so you may have grid the data like this
[LON,LAT] = meshgrid(min(lon):max(lon), min(lat) :max(lat))
Z = griddata(lon,lat, z, LON, LAT)
surf(LON, LAT, Z)
  2 件のコメント
andres
andres 2018 年 10 月 22 日
編集済み: andres 2018 年 10 月 22 日
But "surf" makes 3-D images, doesn't it? I need it to be 2D (sorry I did not put that in the text, but only in the title). As points come from geographical data (lon lat), I want a "map" representation with colors indicating the value of z.
jonas
jonas 2018 年 10 月 22 日
just set the view,
view([0 90])
or use one of the following functions with the same syntax as surf
  • pcolor
  • imagesc
  • contourf
  • mesh

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

製品


リリース

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by