change in histogram distributions
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hi, is it possible to flip a histogram around the peak value? I do not want to flip the axis. Just for performing some checks, I want to invert my distribution from negative skewness to positive skewness, keeping the mean value at its original value. any help is appreciated.
採用された回答
Théophane Dimier
2020 年 12 月 9 日
編集済み: Théophane Dimier
2020 年 12 月 9 日
Hi!
It should be doing the following (considering that a is your input)
[counts,center]=hist(a);
bar(center,counts);
hold on
center_mirror=flip(center);
bar(center_mirror,counts);
This should plot the histogram and the mirrored histogram.
If you want to force it to rotate around the peak (conservation of the mode of the distribution):
[counts,center]=hist(a);
bar(center,counts);
hold on
[~,idx]=max(counts);
center_mirror=2*center(idx)-center;
bar(center_mirror,counts);
I hope it answers your question!
9 件のコメント
Sumera Yamin
2020 年 12 月 11 日
Hi, many thanks for your answer. Your second code is what i wanted to do. However i have a question, you are platting bars (with spaces in between the bars). How can i avoid the spaces between the bars and plot it as a normal histogram bins.
Théophane Dimier
2020 年 12 月 11 日
編集済み: Théophane Dimier
2020 年 12 月 11 日
you can change the width of the bar using the name-pair argument "LineWidth":
bar(center_mirror,counts,"BarWidth",1);
Sumera Yamin
2020 年 12 月 11 日
i did not mean the width of bar, what i meant was the spacing between the bars. I want histogram bins to be next to each other. With bar, they have a spacig in between. i attached the figure for ref.
Théophane Dimier
2020 年 12 月 11 日
編集済み: Théophane Dimier
2020 年 12 月 11 日
It was "BarWidth" and not "LineWidth"... My bad. I have edited the original comment.
Sumera Yamin
2020 年 12 月 11 日
right, i also see it now. many thanks for your help.
Théophane Dimier
2020 年 12 月 11 日
You are welcome! Can you just close the question by accepting the answer, please?
Sumera Yamin
2020 年 12 月 11 日
編集済み: Sumera Yamin
2020 年 12 月 11 日
Yes of course. could you please explain what is "idx" and what is code doing? i want to integrate it in my original code and i cannot understand it, what if i want to use histogram instead of bar
Image Analyst
2020 年 12 月 11 日
The cryptic idx should have been called something more explicit and descriptive, like "indexOfMax". Basically it's the first index (bin number) where the max value (mode) of the histogram appears. Does that explain it better.
Sumera Yamin
2020 年 12 月 11 日
編集済み: Sumera Yamin
2020 年 12 月 11 日
ok, thanks, i understood it now.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Histograms についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
