![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/275620/image.png)
plot 2 different y-values for the same x-value in box plot
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
RAJAT GANGADHARAN
il 6 Mar 2020
Commentato: RAJAT GANGADHARAN
il 7 Mar 2020
I have two sets of data for the same time series. I want to keep the two box plots in the same figure. (not subplot) .my data is as follows:
X = 2000 2010 2020 2030
Y1 = A = 78 85 23 36
Y2 = B = 25 56 49 89
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/275571/image.jpeg)
0 Commenti
Risposta accettata
Adam Danz
il 6 Mar 2020
Check out the boxplotGroup() function on the file exchange. If your boxplot inputs are matrices with the same number of columns, you just need to pack them into a cell array and use this function to group them together.
Let me know if you have any questions.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/275620/image.png)
Più risposte (1)
Aquatris
il 6 Mar 2020
Modificato: Aquatris
il 6 Mar 2020
You are looking for the "bar" function. If you also need the error bars, check out this answer from a previously asked question.
X = [2000 2010 2020 2030] ;;
A = [78 85 23 36];
B = [25 56 49 89];
Y = [A' B'];
bar(X,Y)
2 Commenti
Aquatris
il 6 Mar 2020
You just need to modify the example code I shown with your data. I think you want someoneelse to do your work, in which case this is not the platform for that.
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!