how to change the box width in boxplot?

71 visualizaciones (últimos 30 días)
Cate3
Cate3 el 8 de En. de 2020
Comentada: Cate3 el 9 de En. de 2020
Hi
I wanted to have a boxplot for a poster with different datasets which are divided in different clusters. Now the code works fine, but the boxes are too small for the poster. I tried different things but did not succeed. Could anyone help me please? I'm so lost.
This is the coresponding code:
cluster1 = [1,127; 1,187; 2,144; 2,205; 3,155; 3,229];
cluster2 = [1,66; 1,127; 2,81; 2,144; 3,79; 3,155];
cluster3 = [1,0; 1,66 ;2,0; 2,81; 3,0; 3,79];
boxplot(cluster3(:,2),cluster3(:,1),'PlotStyle','compact','colors', 'r');
hold on
boxplot(cluster2(:,2),cluster2(:,1),'PlotStyle','compact','colors', 'g');
hold on
boxplot(cluster1(:,2),cluster1(:,1),'PlotStyle','compact','colors', 'b');
Thanks a lot!

Respuestas (1)

the cyclist
the cyclist el 8 de En. de 2020
You chose the "compact" plot style. Do you prefer this version, which is the default (non-compact)?
Screen Shot 2020-01-08 at 4.52.07 PM.png
Also, are you sure you are plotting how you want, to best show your data? First, your cluster3 doesn't show up at all. Second, a box plot is not very appropriate when you just have two data points in each cluster.
  1 comentario
Cate3
Cate3 el 9 de En. de 2020
Well actually there are about 600 data points for each set which I cluster. But afterwards the program I used to get the cluster makes those vectors with the min and max point of each cluster and set. So I get the vectors which are in the code posted here (just for the real vectors the contain 15 data sets). Sorry for not mentioning, I thought uploading the whole data is unnecessary.
Oh yes I see, there should not be a blank line in the code, well at least not between cluster3 and hold on. As the hold on is not working on the cluster3 like this. If you delet the blank, it should look like this. Sorry, that did not happen on purpose.
Also I don't need to see the median or mean or anything like that. It is just to show how much of the y-axis = distance is asigned to which plot. So I think the "filled" boxes are fine.
-.png

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by