R 更改栏内文本的大小

R 更改栏内文本的大小,r,ggplot2,R,Ggplot2,制作条形图 library(ggplot2) df <- data.frame(stock = c("google", "google", "amazon", "amazon", "amazon", "yahoo", "yahoo", "yahoo"), status = c("open", "clos

制作条形图

library(ggplot2)
df <- data.frame(stock = c("google", "google", "amazon", "amazon", "amazon", "yahoo", "yahoo", "yahoo"), status = c("open", "close", "open", "buy", "close", "open", "buy", "close"), category = c("daily", "daily", "daily", "daily", "daily", "daily", "daily", "daily"), price = c(330379.36, 52324.62, 545240.22, 192574.83, 46721.34, 477658.62, 146724.44, 42721.78))
ggplot(df, aes(fill=stock, y=reorder(price, status), x= status)) +
     geom_bar(position="dodge", stat="identity") +
     ggtitle("Daily") +
     theme(axis.text.x = element_text(angle = 45, vjust = 0, hjust=0)) +
     geom_text(aes(label=price), position = position_dodge(width= 1), vjust=0.5)
库(ggplot2)

df您可以
geom\u text
中设置
大小
参数:

library(ggplot2)

ggplot(df, aes(fill=stock, y=reorder(price, status), x= status)) +
   geom_bar(position="dodge", stat="identity") +
   ggtitle("Daily") +
   theme(axis.text.x = element_text(angle = 45, vjust = 0, hjust=0)) +
   geom_text(aes(label=price), position = position_dodge(width= 1), 
                 vjust=-1.5, size = 3.3)

是否尝试在
geom_text
中设置
size
参数<代码>几何图形文本(aes(标签=价格),位置=位置减淡(宽度=1),vjust=0.5,大小=3.3)