How to set wiskers and box in the boxplot?
10 views (last 30 days)
Show older comments
Hello, I would like to set none line the outline border of the box , but it becomes black. If I remove the outline border, the wiskers also remove. So I try to change color of the outline border, but wiskers also change color. I would like leave the wiskers lines in black and the border with out the line, just with the fill color. Any help?
Here is my code.
grp = cell2mat(arrayfun(@(i){i*ones(numel(cuad_periodo{i}),1)},(1:numel(cuad_periodo))'));
boxplot(vertcat(cuad_periodo{:}),grp); set(gca,'fontsize',16);hold on
h = findobj(gca,'Tag','Box');
Box=get(get(gca,'children'),'children');set(Box,'Color',[0.4660, 0.6740, 0.1880]);
lines = findobj(gcf, 'type', 'line', 'Tag', 'Median');set(lines, 'Color', 'k','linewidth',2);
for i=1:96
patch(get(h(i),'XData'),get(h(i),'YData'),'y','FaceAlpha',.9,'FaceColor',[0.4660, 0.6740, 0.1880],'LineStyle','none');
end
set(gca,'children',flipud(get(gca,'children')))
h=findobj(gca,'tag','Outliers');delete(h)
3 Comments
Manan Jain
on 9 Jul 2021
Hi, Please share your solution, so others with similiar queries can get help. Thank you !
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!