Plotting boxplots at specific x axis locations over other data

46 vues (au cours des 30 derniers jours)
Sophia
Sophia le 23 Mai 2022
Commenté : Voss le 24 Mai 2022
I would like to plot boxplots at the specific x axis locations of 0, 14, 19, 26 (days), over existing data. In the figure it shows that the boxplots get plotted at the start, is there a way to specify their location or does a second x axis need to be created?
  1 commentaire
dpb
dpb le 23 Mai 2022
Use boxchart with grouping variable by day should work (I think)...

Connectez-vous pour commenter.

Réponse acceptée

Voss
Voss le 23 Mai 2022
You can specify the locations of the boxplots in the x direction using the 'Positions' argument:
ROSdata = readtable('ROS_data.xlsx');
bothgrouped0hr = readtable('both_grouped_0hr.xlsx');
yyaxis left
plot(ROSdata.Time,ROSdata.ROSpercell)
hold on
plot(ROSdata.Time,ROSdata.Expulsion)
hold on
yyaxis right
boxA = boxplot(bothgrouped0hr.Turbinaria,bothgrouped0hr.Day,'Positions',[0, 14, 19, 26]);
hold on
boxB = boxplot(bothgrouped0hr.Duncan,bothgrouped0hr.Day,'Positions',[0, 14, 19, 26]);
  4 commentaires
Sophia
Sophia le 24 Mai 2022
Makes sense, thank-you!
Voss
Voss le 24 Mai 2022
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by