I have a 6×37 matrix of locations in Kilometers, X and Y.
I want to draw a graph with Coc as the color.
I used the code:
figure;
pcolor(X,Y,mean(Coc.*1e3));shading flat
caxis([0 1e-35]);
xlabel('x (kilometres)');
ylabel('y (kilometres)');
h=colorbar;
ylabel(h,'\mu g m^{-3}');
I didn't get any color.

2 件のコメント

KSSV
KSSV 2020 年 8 月 28 日
Your X, Y are not forming a meshgrid....you can just try:
pcolor(Coc) ;
shading interp ;
Aduloju Oluwatobi
Aduloju Oluwatobi 2020 年 8 月 28 日
It's not what I want.

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

回答 (1 件)

Steven Lord
Steven Lord 2020 年 8 月 28 日

0 投票

This smells fishy to me.
caxis([0 1e-35]);
From the documentation page: "caxis(limits) sets the colormap limits for the current axes. limits is a two-element vector of the form [cmin cmax]. All values in the colormap indexing array that are less than or equal to cmin map to the first row in the colormap. All values that are greater than or equal to cmax map to the last row in the colormap. All values between cmin and cmax map linearly to the intermediate rows of the colormap."
The minimum value in your Coc array is about 1.5e-16. The mean of that array cannot be less than that value, and that means all of those values are going to get mapped to the last row in the colormap.
I recommend changing your color axis limits.

1 件のコメント

Aduloju Oluwatobi
Aduloju Oluwatobi 2020 年 8 月 28 日
I already changed it to be between 0 and 1, I still get the same result

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

カテゴリ

ヘルプ センター および File ExchangeColor and Styling についてさらに検索

製品

リリース

R2017a

質問済み:

2020 年 8 月 28 日

コメント済み:

2020 年 8 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by