棒グラフの並び順について
11 views (last 30 days)
Show older comments
カテゴリカル データをもつ棒グラフの作成(https://jp.mathworks.com/help/matlab/ref/bar.html)
を参考に棒グラフを作成しているのですが,棒グラフの並び順をアルファベット順意外(カテゴリ配列順)にしたいです.
どのようにすれば良いでしょうか?
0 Comments
Accepted Answer
michio
on 20 Jan 2020
例えばこういう例ですね。
c = categorical({'apples','pears','oranges'});
prices = [1.23 0.99 2.3];
bar(c,prices)
これはカテゴリ型配列を作る際に順序を指定しておけば入力の順序で表示されます。
c = categorical({'apples','pears','oranges'},{'apples','pears','oranges'},'Ordinal',true);
prices = [1.23 0.99 2.3];
bar(c,prices)
2 Comments
More Answers (0)
See Also
Categories
Find more on Bar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!