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))

これにより、次のプロットが生成されます。

ここに画像の説明を入力

テキストを揃えて、各チャートの先頭から開始するように強制したいので、すべてが表示されます(小さなチャートの外に出ても問題ありません)。どうすればこれを達成できますか?

4

1 に答える 1

2

これはあなたが探しているものですか?

   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)

ここに画像の説明を入力

于 2016-10-27T15:28:06.963 に答える