r - ggplot中换行文本的行距
问题描述
我需要更改包装 geom_text 图层中的行距。
library(ggplot2)
library(stringr)
txt = c('one two three', 'four five six', 'seven eight nine')
p = ggplot(data=NULL, aes(x=1:3, y=1:3, label = str_wrap(txt, width = 3))) +
geom_text() + expand_limits(x = c(0.5, 3.5), y = c(0.5, 3.5))
但theme(text=element_text(lineheight = ...))
没有效果,因为theme
仅适用于plot 的非数据组件,所以我不清楚如何实现这一点。建议?
解决方案
推荐阅读
- javascript - 如何检查两个元素的文本内容是否匹配?
- get - 如何将生成的 Oauth 1.0 标头用于 GET 请求?
- apache - URL 重写问题 (Apache2 / Debian 10)
- github - 如何在 GitHub 操作中推送到受保护的主要分支?
- mysql - SQL 数据库连接数超过 800,000?
- node.js - 加密 des-ede3-cbc nodejs
- c++ - 是否有 std::variant 和 std::visit 方法来替换旧的旧式调度以处理混乱的代码?
- android - 当用户通过软键盘按下退格/擦除时触发某些功能
- apache-kafka - 如何使用 Spring Reactive Kafka 实现重试和恢复逻辑
- firebase - 如何用2个数据进行查询?