Changing colors of outlier markers, median and whiskers in a box and whisker plot
Hello,
So, currently I have the following script to generate a box and whisker plot:
x1 = randn(128, 1);
x2 = randn(100, 1);
X = [x1; x2];
colors = [0 0.4470 0.7410; 0.8500 0.3250 0.0980];
grp = [ones(size(x1)); 2.*ones(size(x2))];
h = boxplot(X, grp, …
‘Colors’,colors, …
‘Symbol’,’.’)
for j=1:size(h,2)
patch(get(h(5,j),’XData’),get(h(5,j),’YData’),get(h(5,j),’Color’),’FaceAlpha’,.7);
end
The result I get is this one:
What I would like to do is to make the whisker line, the median line and the outline markers all black. The end result would be something like this:
Thanks!Hello,
So, currently I have the following script to generate a box and whisker plot:
x1 = randn(128, 1);
x2 = randn(100, 1);
X = [x1; x2];
colors = [0 0.4470 0.7410; 0.8500 0.3250 0.0980];
grp = [ones(size(x1)); 2.*ones(size(x2))];
h = boxplot(X, grp, …
‘Colors’,colors, …
‘Symbol’,’.’)
for j=1:size(h,2)
patch(get(h(5,j),’XData’),get(h(5,j),’YData’),get(h(5,j),’Color’),’FaceAlpha’,.7);
end
The result I get is this one:
What I would like to do is to make the whisker line, the median line and the outline markers all black. The end result would be something like this:
Thanks! Hello,
So, currently I have the following script to generate a box and whisker plot:
x1 = randn(128, 1);
x2 = randn(100, 1);
X = [x1; x2];
colors = [0 0.4470 0.7410; 0.8500 0.3250 0.0980];
grp = [ones(size(x1)); 2.*ones(size(x2))];
h = boxplot(X, grp, …
‘Colors’,colors, …
‘Symbol’,’.’)
for j=1:size(h,2)
patch(get(h(5,j),’XData’),get(h(5,j),’YData’),get(h(5,j),’Color’),’FaceAlpha’,.7);
end
The result I get is this one:
What I would like to do is to make the whisker line, the median line and the outline markers all black. The end result would be something like this:
Thanks! plotting, plot MATLAB Answers — New Questions