0
df.test <- data.frame(val=c(0.55,0.42,-0.05),name=letters[1:3],
desc='This is     the description of values'

p <- ggplot(df.test, aes(name, val, label = desc)) +
    geom_bar(stat = "identity", col = 'black', fill = 'lightgreen') + 
    labs(title = "Test", x = " ", y = "value", fill = "") + 
    theme_bw() + 
    guides(fill = FALSE)

p + geom_text(angle = 90, size = 8, hjust = 1.25, position = position_dodge(width = 0.9))

This generates the following plot:

enter image description here

I want to align the text and force the it to start at the beginning of each chart, so that all of them can be visible (it is ok if it falls outside the small chart). How can I achieve this?

alistaire
  • 42,459
  • 4
  • 77
  • 117
H_A
  • 667
  • 2
  • 6
  • 13

1 Answers1

2

Is this what you're looking for?

   p <- ggplot(df.test,aes(name,val,label=desc))+
      geom_bar(stat="identity",col='black',fill='lightgreen')+ 
      labs(title = "Test", x = " ", y = "value",fill = "")+
      theme_bw()+
      guides(fill=FALSE)
    p+geom_text(angle=90,size=8,hjust=0,aes(x=name,y=rep(0,nrow(df.test)),label=desc),inherit.aes=F)

enter image description here

Haboryme
  • 4,611
  • 2
  • 18
  • 21