Re: [R] geom_text in ggplot (position)

2015-05-13 Thread Dennis Murphy
This problem is discussed in Winston Chang's R Graphics Handbook, section 3.9. Adapting his code to this example: test <- data.frame(variables = c("PE_35", "PE_49"), value1=c(13,3), value2=c(75,31), value3=c(7,17), v

Re: [R] geom_text in ggplot (position)

2015-05-12 Thread Kristina Wolf
This may or may not be helpful, but you can create a dataframe with the geom_text exactly where you want it to be (although it will probably be a lot of extra work and will take time fiddling with it to see if you like how it looks - and I think it looks fine the way you have it already). Example

Re: [R] geom_text in ggplot (position)

2015-05-12 Thread Ista Zahn
Well, the stacking makes it tricky. AFAIK you have to calculate the positions yourself, e.g., melted <- melted[order(melted$variables, melted$cat, melted$cO), ] melted$rec2 <- melted$recuento/2 melted[melted$cO == "B", "rec2"] <- melted[melted$cO == "B", "rec2"] + melted[melted$cO == "A", "recuen

[R] geom_text in ggplot (position)

2015-05-12 Thread AURORA GONZALEZ VIDAL
Hello everybody. I have an "esthetic" question. I have managed to create a stacked and grouped bar plot but I don't manage with putting the text in the middle of the bar plots. Do you know how to write the numbers in that position? Thank you so much. Example code: test  <- data.frame(variables