Manually adjust labels on axis of plot (histogram)

27 ビュー (過去 30 日間)
Vivek Gupta
Vivek Gupta 2020 年 10 月 25 日
編集済み: Cris LaPierre 2020 年 11 月 9 日
Hello all,
I have a set of data I am plotting on an histogram. Because I don't want to completely remove the outliers in my dataset, I manually changed the outlier values to some capped value and created the histogram normally. However, now I want to change the x-axis label for the first column, and last column to show that they might contain outliers. For example, instead of "5", which is generated automatically, it should be "<5". Is there a way to do this?

採用された回答

Cris LaPierre
Cris LaPierre 2020 年 10 月 26 日
編集済み: Cris LaPierre 2020 年 11 月 9 日
You could change the X labels using the xticklabels function.
I'll include a simple example of one way you could achieve this.
% Genreate random data
data = randi(5,[1,100]);
% reclassify extreme values
data(data<2)=2;
data(data>4)=4;
% create historgram (categorical data seems to match your data)
histogram(categorical(data))
% change x tick labels
xticklabels(["<2" "3" ">4"]);
.

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by