How can I change the color of the median line in boxchart?
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
omid zandi
il 12 Lug 2021
Spostato: Cris LaPierre
il 8 Apr 2024
I am creating a box plot using the "boxchart" function. How can I change the color of the median line?
0 Commenti
Risposta accettata
Star Strider
il 12 Lug 2021
It is not possible to change the colours, however it is possible to over-plot the median lines —
x = randn(5); % Create Data
figure
hbx = boxchart(x);
xMdn = median(x);
boxw = hbx.BoxWidth;
xd = 1:numel(hbx.XData);
hold on
plot(0.5*boxw*[-1;1]+xd, [1;1]*xMdn, '-r')
hold off
% get(hbx)
.
6 Commenti
Amelie
il 8 Apr 2024
Spostato: Cris LaPierre
il 8 Apr 2024
I have a follow up question: Is it possible to exclude the median when plotting the boxchart? If so, how can I do it?
Many thanks for your help!
Star Strider
il 8 Apr 2024
Spostato: Cris LaPierre
il 8 Apr 2024
@Amelie —
I’m not certain it can be excluded, however it can be hidden —
x = randn(5); % Create Data
figure
hbx = boxchart(x);
hbx.BoxMedianLineColor = 'g'; % Change 'boxchart' Median Line Colour
figure
hbx = boxchart(x);
hbx.BoxMedianLineColor = 'none'; % Hide 'boxchart' Median Line
.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Scatter Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!