Same boxplot width

50 vues
Accéder directement au premier message non lu

Christos Gkenas

non lue,
8 juil. 2017, 12:59:5208/07/2017
à ggplot2
Hello all
I want to create boxplots with NMDS scores from 2 species collected from 4 different sites. Two sites (Degebe amd Vascao) are allopatric and two other sites (Ardila, Guadiana) are sympatric
I managed to produce a plot with the following R script

(p = ggplot(data = Chris, aes(x=Sites, y=NMDS2, fill=Fishes)) + geom_boxplot(position=position_dodge(1)) +
+ theme_bw(base_size = 18) +
+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) )
> p + scale_fill_manual(breaks = c("A. facetus", "L. gibbosus"),
+ values=c("white", "azure4"))

However, as you can see from the attached figure, the boxplot width from the allopatric sites is the double size of the sympatric ones. I would like to ask if it is possible to have the same width for all the boxplots and second, how to modify the limits of the yaxis, for example form -1.5 to 1.5 in order to be comparable with the scores from the NMDS1

Thank you in advance
Rplot01.pdf

Roman Luštrik

non lue,
8 juil. 2017, 13:19:2608/07/2017
à Christos Gkenas,ggplot2
How many data points are there? If you have a few, you might be better off with a geom_jitter.

Cheers,
Roman

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
In God we trust, all others bring data.

Theo Mouton

non lue,
9 juil. 2017, 03:52:5409/07/2017
à Christos Gkenas,ggplot2

Hi Christos, 

Geom_boxplot has a width attribute. I do not have my scripts here but it was something like geom_boxplot(aes(width=)). You should find this on stack. 

For the y scale doesn't scale_y_continuous() fit ?? 

Cheers, 

Theo 





Theo Mouton
Freshwater Research Assistant
+64-7-859-1889 | Gate 10 Silverdale Road, Hillcrest, Hamilton | www.niwa.co.nz
NIWA
To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com

More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.

Theo Mouton

non lue,
10 juil. 2017, 22:13:5710/07/2017
à Christos Gkenas,ggplot2

Hi Christos,

 

Perhaps this could help, instead of using geom_boxplot you could try :

 

stat_summary(geom="boxplot", aes(width=0.8))

 

Cheers,

 

Theo

--

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message