HISTOGRAM 2 COLOURS - positive numbers red, negative numbers blue
4 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a histogram showing temperature warming (positive numbers) and cooling (negative). It is based on linear regression and the basic code for hte histpgram part is below.
I am wondering is it possible to do the positive bars (there are 1000s) in red and the neg (100s) in blue? Similar to the split in the picture below the code (obviously without the arrow etc.).
slopes = slope_TSA(:);
slopes(isnan(slopes)) = [];
figure;
histogram(slopes);
ylim([0 180000]);
xlim([-0.0001 0.0002]);
title('Distribution of combined ctl slopes - TSA');
0 件のコメント
採用された回答
madhan ravi
2018 年 12 月 4 日
編集済み: madhan ravi
2018 年 12 月 4 日
EDITED
h=histogram(slopes(slopes>0));
h.FaceColor='red'
hold on
h1=histogram(slopes(slopes<0));
h1.FaceColor='blue'
7 件のコメント
madhan ravi
2018 年 12 月 4 日
Download https://www.mathworks.com/matlabcentral/fileexchange/59361-histogram-percentage you may find it useful
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spline Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!