Re: GGplot2 questions

34 vaatamist
Liigu esimese lugemata sõnumi juurde

Rosemary Hartman

lugemata,
26. juuni 2014, 10:31:3526.06.14
kuni Tim Richter-Heitmann,davi...@googlegroups.com
Hi Tim,

Glad you liked the tutorial! Try adding this command to your plot: scale_x_discrete(expand = c(5,1))

From the ggplot documentation:

expand: a numeric vector of length two, giving a multiplicative and additive constant used to expand the range of the scales so that there is a small gap between the data and the axes.

You can adjust the distance between your categorical variables by adjusting the constants in your "expand" expression. Hope that helps! I am forwarding your question to our local R users group listserve to see if anyone else has any insight.

Rosie


On Thu, Jun 26, 2014 at 4:51 AM, Tim Richter-Heitmann <tric...@uni-bremen.de> wrote:
Hi!

I just assume, you are the one who has published the beautiful ggplot2 tutorial in:

http://www.noamross.net/blog/2013/11/20/formatting-plots-for-pubs.html

I do have a very basic question, but its giving me fits (i am somewhat new to R).

I have two plots (one is facetted version of the other), resulting from:

ggplot(datamelt, aes(x = OTU, y = rel_abundance) +
     theme_bw() +
     geom_point(aes(col = factor(date))) +
     scale_y_log10(breaks=c(.0000001, .000001,.00001,.0001,.001,.01,.1,1)) +
     scale_color_manual(values = c("red", "darkgreen", "blue", "brown", "orange", "black")) +
     theme(legend.position = "bottom") +
     coord_flip()

The problem is: I just want to shrink the plots. The distances between each line (November, October a.s.o) are just too far away from each other. I tried with width and height, but it doesnt do anything. Do you have any ideas to reduce the plotting area?
Thank you very much!





--
Tim Richter-Heitmann (M.Sc.)
PhD Candidate



International Max-Planck Research School for Marine Microbiology
University of Bremen
Microbial Ecophysiology Group (AG Friedrich)
FB02 - Biologie/Chemie
Leobener Straße (NW2 A2130)
D-28359 Bremen
Tel.: 0049(0)421 218-63062
Fax: 0049(0)421 218-63069


Facet_wrap.pdf
NOB.pdf
Vasta kõigile
Vasta autorile
Saada edasi
0 uut sõnumit