color changing bar graph

1 回表示 (過去 30 日間)
ralph glastonbury
ralph glastonbury 2020 年 4 月 14 日
コメント済み: ralph glastonbury 2020 年 4 月 16 日
how can i plot a horozontal bar graph where the bars color change acording to a formula?
i have 5 different hights (70, 115, 164, 216, 270) each going from 0 to 130 that change intensity acording to different formula for each hight
i want to draw a horozontal bar graph with hights on y axes 0-130 on y axes and the bar changing colors accoring to the formulas
  10 件のコメント
Mehmed Saad
Mehmed Saad 2020 年 4 月 16 日
編集済み: Mehmed Saad 2020 年 4 月 16 日
is this right? i am only change R and B values not G
ralph glastonbury
ralph glastonbury 2020 年 4 月 16 日
yes that is what im looking for

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

採用された回答

Mehmed Saad
Mehmed Saad 2020 年 4 月 14 日
編集済み: Mehmed Saad 2020 年 4 月 16 日
Now i am giving you code for only generating 1 peak which is random, you ve to generate the remaining by yourself
figure,
h=barh([0 1],[zeros(1,131);randi(3,1,131)],'stacked','BarWidth',0.4);
X = 0:130;
Y = 0.000000272010410*X.^3 - 0.000071941838974*X.^2 + 0.004930888800712*X + 1.902355241509030;
Z=Y-min(Y);
Z=Z/max(Z);
for i=1:131
h(i).FaceColor = [1-Z(i) 0 Z(i)];%m(i,:);
h(i).EdgeColor = [1-Z(i) 0 Z(i)];%m(i,:);
end
  1 件のコメント
ralph glastonbury
ralph glastonbury 2020 年 4 月 16 日
thank you so much

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by