Why are the descriptive names of my boxchart categories not visible in my figure?
Hi all, I am trying to visualise ply thicknesses (in multiple composite samples) using boxchart(). I manage to show the boxes according to the ply numbers. However, I would like to mention the fibre orientation with the ply numbers as well. The (adapted, for readability) code I used so far is shown below. I also included the result I obtained.
My problem is that the y-axis do not show both the number and the orientation of the plies. I tried to follow the "Create Multiple Box Charts Using Positional Grouping Variable" example in the boxchart documentation, because this example shows the replacement of numbered axis-ticklabels to a descriptive label (just like I want my axis to be). It tells me to use categorical() to "replace" the plain ply numbers, after which I need to use boxchart. Although I think I applied this example correctly to my case and all intermediate steps look like they were executed as desired, the figure does not turn out as intended. Why are the descriptive names on the y-axis not visible in the figure?
table = array2table([nr t]; % A table containing the ply numbers (pnr) and their corresponding thicknesses (t). This outputs a table with many rows (the amount of samples with n plies) by 2 columns (pnr and t)
for i = 1:nplies
p_ors_str = string(sprintf(‘%02i: %i%c’,nply(i),layup_weld(i),char(0176)))); % Describing the ply number with the corresponding orientation
end % Results in a nplies*1 string containing element similar to "01: 45°".
p_ors_cat = categorical(table.nr,1:nplies,p_ors_str); % Converting the ply numbers to a descriptive string in a categorical array
figure(1), clf(1), hold on
subplot(2,1,1), hold on % This method corresponds to the "boxchart(earthquakes.Month,earthquakes.EarthquakeMagnitude)"-command in the example
boxchart(table.pnr,table.t,’Orientation’,’Horizontal’) % The boxes visualise the several measurements for every ply, showing ply numbers
ylabel(‘Ply number’)
subplot(2,1,2), hold on % This method corresponds to the "boxchart(namedMonths,earthquakes.EarthquakeMagnitude)"-command in the example
boxchart(p_ors_str,table.t,’Orientation’,’Horizontal’) % The boxes should visualise the same as before, but describing the ply number with their orientation
ylabel(‘Ply number and orientation’)Hi all, I am trying to visualise ply thicknesses (in multiple composite samples) using boxchart(). I manage to show the boxes according to the ply numbers. However, I would like to mention the fibre orientation with the ply numbers as well. The (adapted, for readability) code I used so far is shown below. I also included the result I obtained.
My problem is that the y-axis do not show both the number and the orientation of the plies. I tried to follow the "Create Multiple Box Charts Using Positional Grouping Variable" example in the boxchart documentation, because this example shows the replacement of numbered axis-ticklabels to a descriptive label (just like I want my axis to be). It tells me to use categorical() to "replace" the plain ply numbers, after which I need to use boxchart. Although I think I applied this example correctly to my case and all intermediate steps look like they were executed as desired, the figure does not turn out as intended. Why are the descriptive names on the y-axis not visible in the figure?
table = array2table([nr t]; % A table containing the ply numbers (pnr) and their corresponding thicknesses (t). This outputs a table with many rows (the amount of samples with n plies) by 2 columns (pnr and t)
for i = 1:nplies
p_ors_str = string(sprintf(‘%02i: %i%c’,nply(i),layup_weld(i),char(0176)))); % Describing the ply number with the corresponding orientation
end % Results in a nplies*1 string containing element similar to "01: 45°".
p_ors_cat = categorical(table.nr,1:nplies,p_ors_str); % Converting the ply numbers to a descriptive string in a categorical array
figure(1), clf(1), hold on
subplot(2,1,1), hold on % This method corresponds to the "boxchart(earthquakes.Month,earthquakes.EarthquakeMagnitude)"-command in the example
boxchart(table.pnr,table.t,’Orientation’,’Horizontal’) % The boxes visualise the several measurements for every ply, showing ply numbers
ylabel(‘Ply number’)
subplot(2,1,2), hold on % This method corresponds to the "boxchart(namedMonths,earthquakes.EarthquakeMagnitude)"-command in the example
boxchart(p_ors_str,table.t,’Orientation’,’Horizontal’) % The boxes should visualise the same as before, but describing the ply number with their orientation
ylabel(‘Ply number and orientation’) Hi all, I am trying to visualise ply thicknesses (in multiple composite samples) using boxchart(). I manage to show the boxes according to the ply numbers. However, I would like to mention the fibre orientation with the ply numbers as well. The (adapted, for readability) code I used so far is shown below. I also included the result I obtained.
My problem is that the y-axis do not show both the number and the orientation of the plies. I tried to follow the "Create Multiple Box Charts Using Positional Grouping Variable" example in the boxchart documentation, because this example shows the replacement of numbered axis-ticklabels to a descriptive label (just like I want my axis to be). It tells me to use categorical() to "replace" the plain ply numbers, after which I need to use boxchart. Although I think I applied this example correctly to my case and all intermediate steps look like they were executed as desired, the figure does not turn out as intended. Why are the descriptive names on the y-axis not visible in the figure?
table = array2table([nr t]; % A table containing the ply numbers (pnr) and their corresponding thicknesses (t). This outputs a table with many rows (the amount of samples with n plies) by 2 columns (pnr and t)
for i = 1:nplies
p_ors_str = string(sprintf(‘%02i: %i%c’,nply(i),layup_weld(i),char(0176)))); % Describing the ply number with the corresponding orientation
end % Results in a nplies*1 string containing element similar to "01: 45°".
p_ors_cat = categorical(table.nr,1:nplies,p_ors_str); % Converting the ply numbers to a descriptive string in a categorical array
figure(1), clf(1), hold on
subplot(2,1,1), hold on % This method corresponds to the "boxchart(earthquakes.Month,earthquakes.EarthquakeMagnitude)"-command in the example
boxchart(table.pnr,table.t,’Orientation’,’Horizontal’) % The boxes visualise the several measurements for every ply, showing ply numbers
ylabel(‘Ply number’)
subplot(2,1,2), hold on % This method corresponds to the "boxchart(namedMonths,earthquakes.EarthquakeMagnitude)"-command in the example
boxchart(p_ors_str,table.t,’Orientation’,’Horizontal’) % The boxes should visualise the same as before, but describing the ply number with their orientation
ylabel(‘Ply number and orientation’) boxchart, plotting, boxplot, yticklabels, ticklabels, xticklabels, composites MATLAB Answers — New Questions