How to make this plot?

Dear all, I have a table namely DATA. I don't know how to have a plot like this in the below for it.
Any advice is highly appreciated.

 采纳的回答

Sibi
Sibi 2020-11-25
编辑:Sibi 2020-11-25
d=DATA{:,1};D=DATA{:,2};
min_year=year(min(d));
max_year=year(max(d));
A=zeros(12,max_year-min_year+1);
for k=1:length(d)
m=month(d(k));y=year(d(k))-min_year+1;
A(12-m+1,y)=D(k);
end
in=[min_year:max_year];%% added
contourf(in,1:12,A)%% edited
map = [0.8 0.1 0.1
0.9 0.9 0.1
1 1 1
0 0.9 0.1
0.1 0.1 1];
colormap(map)
colorbar
you can change the color by changing values in map

3 个评论

Thank you so much it's amazing and exactly that's what I want really appreciate it. Is any solution exist to have the x-axis as years?
Sibi
Sibi 2020-11-25
编辑:Sibi 2020-11-25
I have edited the code,try now.
For more details check xticks and xticklabels in documentation .
Thank you so much again.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Annotations 的更多信息

产品

版本

R2020a

标签

提问:

BN
2020-11-25

评论:

BN
2020-11-25

Community Treasure Hunt

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

Start Hunting!

Translated by