2
dotAW <- A_W_point
dotAW <- ggplot(dotAW,aes(x=AASW, y=WW, fill=taxa))  
dotAW <- dotAW  + geom_jitter(aes(color = taxa), size = 4)
dotAW <- dotAW  +geom_abline(intercept = 0, slope = 1)
dotAW <- dotAW + scale_y_continuous(limits=c(0,0.5)) + scale_x_continuous(limits=c(0,0.5))
dotAW

ggsave(dotAW, file="dotAW.pdf", width=12, height=10)

With this plot I want to correlate relative abundance of bacterial taxa. I have some issues to solve, where I need help

1) I want to change the color with eg + scale_fill_hue(l=45) or by creating my own color vector, but I don't know where to place it in the script, the colors are defined somehow connected to geom_jitter. In the end I want for each taxa an individual combination of color and shape to distinguish them in the plot easier than only using color.
2) I would like to define the dimension of the plot already before saving. Where and how can I add the height and width before?
3) Is the use of geom_jitter correct? It's a bit tricky for me to understand what it does.

here is a link to the data, unfortunately I cannot post an image yet: http://goo.gl/8dZoAq

Thanks!

IRich
  • 27
  • 2
  • 7
  • You are more likely to get help if you provide at least a sample of your data. Either edit your question to do that, or upload you data somewhere (Dropbox?) and provide a link to it in your question. As is, I have no idea what you are trying to accomplish. – jlhoward Mar 10 '14 at 18:35
  • As @jlhoward already said: at this moment its hard to help you. For inspiration: [How to make a great R reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Jaap Mar 10 '14 at 20:32
  • It is not wise to give your plot the same name as your dataset. Furthermote, it's not clear to me what you want to achieve with `dotAW <- A_W_point`. Can you explain that? – Jaap Mar 16 '14 at 13:31
  • there is not so much of reasoning for that, I thought it might be useful when have different files I work with treating them in the same way. I simplified question one just now.. – IRich Mar 17 '14 at 11:01

1 Answers1

0

With geom_jitter the point are plotted in their exact location, but somewhat besides that (above/below and/or right/left).

I've put your data in a dataframe df. Then you can create your plot with:

dotAW <- ggplot(df,aes(x=AASW, y=WW, color=taxa)) + 
  geom_point(shape = 20, size = 4, position = "jitter") +
  geom_abline(intercept = 0, slope = 1) + 
  scale_y_continuous(limits=c(-0.05,0.5)) + 
  scale_x_continuous(limits=c(-0.05,0.5)) +
  scale_color_hue()
dotAW

which gives the following result:

enter image description here

You can set the colors manually with scale_color_manual() like this:

scale_color_manual(values = c("Flavobacteriaceae"="red", "Oceanospirillales"="blue", "Gammaproteobacteria" = "green"))
Jaap
  • 81,064
  • 34
  • 182
  • 193