フィルターのクリア

short format for the normalized histogram

1 回表示 (過去 30 日間)
Torkan
Torkan 2020 年 2 月 19 日
コメント済み: Torkan 2020 年 2 月 19 日
Hello,
I have the figure below. Does anybody know how can I use just two decimal points? I used the code below for plotting
r = histogram(angle_degree,'Normalization','pdf')
histfit(angle_degree,25,'normal')
yt = get(gca, 'YTick');
set(gca, 'YTick', yt, 'YTickLabel', yt/numel(angle_degree))
I want to show yt/numel(angle_degree) just two decimal points after dot.
Thanks

回答 (1 件)

Steven Lord
Steven Lord 2020 年 2 月 19 日
One way to do this is to use the ruler object representing the Y axis and change the TickLabelFormat for that axis. Using a slightly modified version of one of the examples from the histogram documentation page, let's create a histogram.
x = randn(10000,1);
h = histogram(x, 'Normalization', 'pdf');
Get the handle to the axes in which the histogram is located.
ax = ancestor(h, 'axes');
Get the handle to the Y axis ruler of that axes.
Y = ax.YAxis;
Change the TickLabelFormat to something that provides 4 decimal places.
Y.TickLabelFormat = '%0.4f';
  1 件のコメント
Torkan
Torkan 2020 年 2 月 19 日
Thank you! It is good,
However, when I use histfit everything is collapsed! Just use histfit after your own code

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

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by