直接标签中的标签大小geom_dl() [英] Label size in directlabels geom_dl()
问题描述
我真的很喜欢 directlabels
包,用于动态定位图的标签.尽管仍然不够完善,但它可以合理地防止散点图的标签之间有很多点重叠-例如专门用于图表的草稿版本,而不是最终版本的图表.
I have really enjoyed the package directlabels
for dynamic positioning the lables of a plot. Although still not perfect, it helps reasonably to prevent overlaps between labels of a scatter plots with many points for example - specially for the draft version of the charts, not the final one.
但是,在使用 geom_dl()
函数时,我仍然找不到更改标签大小的方法.反正有吗?
However I can not find anyway to change the label size while using geom_dl()
function. Is there anyway?
我试图将 size
和 cex
作为常规参数或 aes()
参数传递给该函数.
I have tried to pass size
and cex
as a normal or aes()
argument to the function.
推荐答案
将 cex
放入列表中.其他格式设置功能也应放在列表中.请参阅?directlabels :: geom_dl
Put cex
inside a list. Other formatting features should also be placed in the list. See some of the examples in ?directlabels::geom_dl
library(ggplot2)
library(directlabels)
dat = data.frame(x = 1:10, y = 1:10, z = letters[1:10])
ggplot(dat, aes(x, y)) +
geom_point() +
geom_dl(aes(label = z), method = list(cex = 2, rot = -45, hjust = -.5))
编辑
该方法也放置在列表中:
The method too is placed in the list:
ggplot(dat, aes(x, y)) +
geom_point() +
geom_dl(aes(label = z), method = list("smart.grid", cex = 2))
这篇关于直接标签中的标签大小geom_dl()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!