Use patch() with boxplot
古いコメントを表示
Hi
I have a boxplot and want to color the chart area behind it.
How it that possible?
I am using patch und boxchart right now. But the boxplot overrides the patch, and if I use the patch after the boxplot its overlaying the boxplot.
I simply need a colorized area below a yline. maybe there is a different way to do so.
greetings
回答 (1 件)
fill(rand(1,5)*3, rand(1,5)*sqrt(2), 'g');
hold on
boxplot(rand(5,3))
hold off
3 件のコメント
Walter Roberson
2023 年 10 月 24 日
Note, by the way, that boxplot() does not fill areas -- it only creates line() objects.
Perhaps the OP doesn't have the stats toolbox, and therefore needs the boxchart function. The boxchart function converts the x-axis to categorical, so you need to massage the inputs a bit.
fill(rand(1,5)*3, rand(1,5)*sqrt(2), 'g');
hold on
ydata = rand(5,3);
xdata = ( 1:size(ydata,2) ).*ones(size(ydata)); % use implicit expansion
boxchart(xdata(:),ydata(:))
hold off
daniel125
2023 年 10 月 25 日
カテゴリ
ヘルプ センター および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

