Skip to content

Commit e73c72b

Browse files
authored
Update figure_boxplot.m
1 parent 2d3820f commit e73c72b

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Boxplot/figure_boxplot.m

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1515
% Written by: Ahmed Abdul Quadeer
1616
% E-mail: ahmedaq@gmail.com
17-
% Last change: Apr. 24, 2018
18-
% Copyright (c) Ahmed Abdul Quadeer, 2018
17+
% Last change: May 29, 2018
18+
% Copyright (c) Ahmed Abdul Quadeer, 2019
1919
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2020
%
2121
% Inputs:
@@ -149,6 +149,20 @@
149149
no_boxplots = size(data_input,2);
150150
end
151151

152+
if no_boxplots>9 || isempty(data_input)
153+
fprintf('\nWarning: The number of box plots to be plotted is greater than colors in the selected scheme. Using one color for all boxes.')
154+
end
155+
156+
%Defaults
157+
box_lineWidth = 0.5;
158+
box_widths_value = 0.3;
159+
160+
if no_boxplots>9
161+
box_color = [0.9020 0.2941 0.2078];
162+
else
163+
box_color = color_scheme_npg(1:no_boxplots,:);
164+
end
165+
152166
%Defaults
153167
box_lineWidth = 0.5;
154168
box_widths_value = 0.3;
@@ -450,10 +464,6 @@
450464
ylim_max = ylim_max_in;
451465
end
452466

453-
if no_boxplots>9 || isempty(data_input)
454-
error('Error! The number of box plots to be plotted is greater than colors in the selected scheme. Specify a color vector.')
455-
end
456-
457467
%% Preprocessing data for plotting
458468

459469
data = [];

0 commit comments

Comments
 (0)