フィルターのクリア

How to plot histogram using given data ?

1 回表示 (過去 30 日間)
Safia
Safia 2023 年 2 月 23 日
コメント済み: Voss 2023 年 2 月 24 日
Hello!
I'm asking if it is possible to insert data in matlab and use them to plot histogram with different colors?
i have already used excel but i need a different form of histogram (bar forms), for example the first bar contains circles, the second contains squares,...
here is my data
Value first Second third
10 0,67 0,66 0,70
20 0,38 0,37 0,42
30 0,26 0,25 0,30
40 0,19 0,19 0,24
50 0,15 0,15 0,21
i need to see "first", "second" and "third" as function of value
Thanks in advance
  2 件のコメント
Adam Danz
Adam Danz 2023 年 2 月 23 日
> is it possible to insert data in matlab and use them to plot histogram with different colors?
Yes, one set of bars will be generated for each column of data, each with a different color.
data = randn(1000,3)+[-2 2 5];
hold on
histogram(data(:,1))
histogram(data(:,2))
histogram(data(:,3))
> i need a different form of histogram (bar forms)... the first bar contains circles, the second contains squares
Not sure what this means, please elaborate or show us an image.
Safia
Safia 2023 年 2 月 24 日
@Adam Danz hello!
this is what i get with excel ,how to plot this in matlab?

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

採用された回答

Voss
Voss 2023 年 2 月 24 日
% Value first Second third
M = [ ...
10 0.67 0.66 0.70; ...
20 0.38 0.37 0.42; ...
30 0.26 0.25 0.30; ...
40 0.19 0.19 0.24; ...
50 0.15 0.15 0.21; ...
];
bar(M(:,1),M(:,2:end))
  2 件のコメント
Safia
Safia 2023 年 2 月 24 日
@Voss thank you very much.
It is possible to modify its form like this
Voss
Voss 2023 年 2 月 24 日
Look into the hatchfill2 function on the File Exchange in the link shared by VBBV.

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

その他の回答 (1 件)

VBBV
VBBV 2023 年 2 月 23 日
Check the answer from the below link
May be its hatch property of the bar which should be used. It seems this is not default Matlab property for bar & histogram functions. You need to use the below custom function available from File Exchange.
  1 件のコメント
Safia
Safia 2023 年 2 月 24 日
@VBBV thank you .This is what i need but at first i don't know how to plot hisotgram in matlab when i already have data

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by