Last active
September 21, 2021 17:37
-
-
Save raviramanathan/9367925 to your computer and use it in GitHub Desktop.
Controlling boxplots in Matlab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Controlling boxplots in Matlab | |
The tricky problems I found was | |
1) in controlling the width of the lines for the outlines of the boxes in the boxplots and | |
h=boxplot(DATA,Vect) | |
for ih=1:numRowsOfDATA | |
set(h(ih,:),'LineWidth',2); % Set the line width of the Box outlines here | |
end | |
2) changing the fontsize of the axis labels for X axes! | |
for example, | |
box on %would only impact one of the axes - Yaxes ! | |
The work around to increase size of XTicks was: | |
set(findobj(gca,'Type','text'),'FontSize',12,'fontWeight','bold') % to set Xaxis | |
set(gca,'FontSize',12,'Fontweight','bold') % to set Yaxis | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all | |
close all | |
a=rand(5)*100 | |
%figure To create default box plot of matlab | |
subplot 221 | |
h=boxplot(a) | |
%figure To change the linewidth of the box plot, | |
subplot 222 | |
hl=boxplot(a) | |
for ih=1:6 | |
set(hl(ih,:),'LineWidth',2); | |
end | |
%figure To change the color of the blox plot, here green is used | |
subplot 223 | |
hc=boxplot(a,'Color','g') | |
%figure, To change colour as well as linewidth | |
subplot 224 | |
hlc=boxplot(a,'Color','r') | |
for ih=1:6 | |
set(hlc(ih,:),'LineWidth',2); | |
end | |
% taken from : http://vikas-ke-funde.blogspot.com.es/2009/04/matlab-boxplot-how-to-change-line-width.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change line width of markers for outliers as well: