r - 在 geom_text 中指定标签的位置
问题描述
我创建了一个条形图,后来添加了 geom_text。我想让标签从每个条的底部开始,我尝试使用位置 vjust 和 hjust,还指定 y = 0,但它们不起作用,因为标签有不同的长度。如果可能的话,我想通过指定 geom_text 参数来解决它。这是我的情节的一部分:
我想让每个标签都从相同的高度开始,或者只是在每个栏的底部
代码类似于我原来的
xxx <- sample(letters,1000, replace = T)
xxx <- data.frame(x=xxx)
text <- c(rep(c("b","adsasdasasd"),13))
library(tidyverse)
xxx %>%
count(x) %>%
ggplot(aes(x,n))+
geom_bar(stat="identity")+
geom_text(aes(x, label = text),y=0, angle=90)
解决方案
推荐阅读
- ios - 当像 Instagram 探索页面一样“拉动刷新”时如何随机化 uıcollecitonview 单元格
- mysql - SQL 内连接选择订单项
- python - 从 Python DGRAM 套接字获取目标 IP 和端口
- python - 将json文件加载到python时解码错误
- android - 从 json 数组中读取数据以绘制在图中
- android - 如何为多个 CPU 架构拆分 apk?
- java - 如何在尝试执行注册活动时修复 android 中的“com.android.Volley.TimeoutError”
- c# - 如何在代码中编辑 settings.settings connectionString?
- javascript - 如何使用 css 定位 svelte 中的组件?
- haskell - 命令“ghc”返回变量不在范围内