フィルターのクリア

How to plot a Map with 2 dimensional colorbar?

9 ビュー (過去 30 日間)
sid Chen
sid Chen 2019 年 10 月 14 日
コメント済み: sid Chen 2019 年 10 月 15 日
Hi, I want to plot like this figure.
My question is how to get colorbar like this one, the shape of the figure( like this map) doesn`t matter( Now it`s a gobal spatial pattern, it could be anything else)
at each point on the map, I have 2 values, mapping to one color in the two dimensional colorbar.
Snipaste_2019-10-14_12-38-34.png
  3 件のコメント
sid Chen
sid Chen 2019 年 10 月 14 日
It`s my fault that my expression is not clear.
The trouble is how to get 2-D colorbar, I only know how to plot with 1-D colorbar.The position doesn`t bother me.
Thanks for comments.
Adam
Adam 2019 年 10 月 14 日
As mentioned, there is no functionality for a 2d colourbar in Matlab, but you can create your 2d image representing your 2d colourmap easily and just plot it using imagesc on its own axes that you can position wherever you want.

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

採用された回答

darova
darova 2019 年 10 月 14 日
Here is a way:
clc,clear
n = 100;
I = zeros(n,n,3);
h = linspace(0,1/6,n);
s = linspace(1,0,n/2);
[H,S] = meshgrid(h,s);
I(:,:,1) = [H+0.5; H];
I(:,:,2) = [S; flipud(S)];
I(:,:,3) = [S; flipud(S)]/2+0.5;
I1 = hsv2rgb(I);
imshow(I1)
12333.png
  1 件のコメント
sid Chen
sid Chen 2019 年 10 月 15 日
Wow, Thanks!
it`s amazing!

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

その他の回答 (1 件)

Alaster Meehan
Alaster Meehan 2019 年 10 月 14 日
I don't think Matlab has anything that can do this nativly, but I will follow just incase any has a better idea then me.
My thoughts...
Generate an image/matrix that is what you want you color bar to look like. Use the subplot function to plot your image/map and your colorbar image next to each other.
Cheers Alaster
  1 件のコメント
sid Chen
sid Chen 2019 年 10 月 14 日
Still Thanks!
I will be wating for the answer.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by