[英]R: ggfortify: specify column to use for labels in plots
I'm using ggfortify
to draw some diagnostic plots for my lm
and glm
objects, but I can't figure out how to specify the labels to use. 我正在使用
ggfortify
为我的lm
和glm
对象绘制一些诊断图,但我无法弄清楚如何指定要使用的标签。 Right now, it uses the observation numbers. 现在,它使用观察数字。 I'd rather it use a column named "community" in
df.ca
for the label names. 我宁愿在
df.ca
使用名为“community”的df.ca
作为标签名称。
The GLM example here shows text like I'm looking to do, and I can't see any different specifications under label.label
or anything similar. 这里的GLM示例显示了我正在寻找的文本,我在
label.label
或类似的东西下看不到任何不同的规范。
Here's my data in RDS format. 这是我的RDS格式的数据。 The dataframe is 77x202 so I haven't copied it here.
数据帧是77x202所以我没有在这里复制它。
Here's the code that specifies the model and then plots: 这是指定模型的代码,然后绘制:
summary(m.ca.ppc <- lm(ppc ~ medinc + hisp + black + asian, data = df.ca))
autoplot(m.ca.ppc, which = 1:6, ncol = 3, label.size = 3)
My questions are: 我的问题是:
[edited to clarify after questions in the comments] [编辑后在评论中提出澄清]
您必须激活文本标签,指向相关列,然后关闭点。
autoplot(m.ca.ppc, data = df.ca, label.size = 3, label=TRUE, label.label="community", shape=FALSE, which=1:6, ncol=3)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.