How to rotate histograms?

17 ビュー (過去 30 日間)
Mr M.
Mr M. 2015 年 10 月 5 日
How to plot histogram on the y-axis?

採用された回答

Image Analyst
Image Analyst 2015 年 10 月 5 日
Did you look at the bottom of the bar() documentation in the "See also" section and notice the barh() function? Does that do what you want?
  3 件のコメント
Image Analyst
Image Analyst 2015 年 10 月 6 日
Maybe try experimenting with the xdir property of the axis, something like
set(gca, 'xdir', 'reverse');
Giuseppe Degan Di Dieco
Giuseppe Degan Di Dieco 2021 年 5 月 18 日
Dear Image Analyst,
hope you are still reading in these days, just to say that your tip worked for yaxis of barh too.
Thanks for your help.
I attach the code for the community.
b2 = barh(GSCS.GroupCount, 'FaceColor', 'flat');
myColor=rand(height(GSCS.GroupCount), 3);
b2.CData = myColor;
yticklabels = repmat('A', ...
height(GSCS.SuperstructureConstructionSystem), 1);
yticklabels = string(yticklabels);
for i = 1:height(GSCS.SuperstructureConstructionSystem)
yticklabels(i) = GSCS.SuperstructureConstructionSystem(i);
end
xlabel('No. of bridges', 'FontSize', 12);
ylabel('Superstructure Construction System', 'FontSize', 12);
% xtickangle(90);
ax = gca;
ax.XAxis.FontSize = 12;
ax.YTick = 1:1:height(GSCS.SuperstructureConstructionSystem);
ax.YAxis.TickLabels = yticklabels;
ax.YAxis.FontSize = 8;
set(ax, 'ydir', 'reverse')
Best.

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

その他の回答 (1 件)

Steven Lord
Steven Lord 2015 年 10 月 5 日
If you're using the HISTOGRAM function, see the Orientation property of the Histogram object that function returns.

カテゴリ

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