ヒストグラムのx軸とy軸を指定する。

例えば計算結果がx=1,1,1,1,1,2,2,2,2,2だったとして、本当はx軸を1、2、3などとして、y軸を結果の値(一個目なら1、10個目なら2)というふうに表示したいのですが、結果がx軸が結果の値、y軸が結果の値が何回あったか(xが1の時yが5、xが2の時yが5)となってしまいます。
わかる方いらっしゃったら教えていただきたいです。

Respuestas (1)

Atsushi Ueno
Atsushi Ueno el 26 de Oct. de 2023

0 votos

言葉通りに解釈すると、それはヒストグラムではなく棒グラフだと思います。
x = [1,1,1,1,1,2,2,2,2,2];
bar(x) % x軸を1,2,3,...、y軸を結果の値(1個目なら1, 10個目なら2)

Etiquetas

Preguntada:

el 25 de Oct. de 2023

Respondida:

el 26 de Oct. de 2023

Community Treasure Hunt

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

Start Hunting!