![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/279257/image.jpeg)
boxplotの中央値の消去&ひげを実線にする方法
조회 수: 17 (최근 30일)
이전 댓글 표시
タイトルの通りですが,boxplotのオプションの設定方法が分かりません.
boxplotの中央値の消去(白線でもOK)し,ひげを実線にしたいです.
boxplot(x,'PlotStyle','compact')とすると,実線のひげの箱ひげ図が書けますが,
今回はボックス自体は元のままにしたいので,('PlotStyle','compact')は使えません.
댓글 수: 0
채택된 답변
Kenta
2020년 3월 25일
clear;clc;close all
rng default
x = randn(100,10);
f=figure
xx=[1:10];
boxplot(x,'positions',xx)
% Find handle for median line and set visibility off
h = findobj(gca,'Tag','Median');
set(h,'Visible','off');
こんにちは、findobj関数で、中央値を参照し、visible => offとすると、以下のようになります。ただ、破線を実線にする方法はわかりませんでした。
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/279257/image.jpeg)
댓글 수: 2
Akira Agata
2020년 3월 25일
편집: Akira Agata
2020년 3월 25일
こんにちは。Kentaさんご指摘のとおり、まずfindobj関数を使って対象となるラインオブジェクトを抽出したうえで、プロパティ値(今回のケースでは 'LineStyle' など)を調整することで実現可能です。一例を以下に示します。
% Sample data
rng('default');
x = randn(100,2);
% Boxplot
figure
boxplot(x)
% Set 'Median' line style
h = findobj(gca,'Tag','Median');
set(h,'LineStyle','none');
% Set 'Upper/Lower Whisker' line style
h = findobj(gca,'Tag','Lower Whisker','-or','Tag','Upper Whisker');
set(h,'LineStyle','-');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/279280/image.png)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Box Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!