棒グラフの並び順について

20 visualizaciones (últimos 30 días)
Teppei Iwata
Teppei Iwata el 20 de En. de 2020
Comentada: michio el 20 de En. de 2020
カテゴリカル データをもつ棒グラフの作成(https://jp.mathworks.com/help/matlab/ref/bar.html)
を参考に棒グラフを作成しているのですが,棒グラフの並び順をアルファベット順意外(カテゴリ配列順)にしたいです.
どのようにすれば良いでしょうか?

Respuesta aceptada

michio
michio el 20 de En. de 2020
例えばこういう例ですね。
c = categorical({'apples','pears','oranges'});
prices = [1.23 0.99 2.3];
bar(c,prices)
untitled1.png
これはカテゴリ型配列を作る際に順序を指定しておけば入力の順序で表示されます。
c = categorical({'apples','pears','oranges'},{'apples','pears','oranges'},'Ordinal',true);
prices = [1.23 0.99 2.3];
bar(c,prices)
untitled1.png
  2 comentarios
Teppei Iwata
Teppei Iwata el 20 de En. de 2020
Barのほうではなく,カテゴリのほうに順序を表すオプションがあったんですね...
無事解決いたしました,ありがとうございました.
michio
michio el 20 de En. de 2020
お役に立てて幸いです。確かに bar の方にも欲しいですね。

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!