【问题标题】:Modify point stroke on a PCA biplot using autoplot function使用自动绘图功能修改 PCA 双图上的点行程
【发布时间】:2019-03-25 10:15:37
【问题描述】:

我正在使用 autoplot 函数来制作 PCA 双图。就我而言,我想增加点笔画以提高情节的可读性。我该怎么做?

这是一个例子:

library(ggfortify)
df <- iris[c(1, 2, 3, 4)]
autoplot(prcomp(df), data = iris, colour="Species", fill="Species", shape="Species", geom="points", size=2) +
  scale_color_manual(values=c("#1B9E77","#D95F02","#7570B3")) +
  scale_fill_manual(values=c("#ffffff","#ffffff","#ffffff")) +
  scale_shape_manual(values=c(21:23))

【问题讨论】:

  • 当您说“点笔画”时,您是指字符的整体大小还是指边框的粗细?
  • 这里指的是点边界的粗细

标签: r ggplot2 ggfortify biplot


【解决方案1】:

我通过将最后一行代码添加到情节中找到了问题的解决方案:

library(ggfortify)
df <- iris[c(1, 2, 3, 4)]
p <- autoplot(prcomp(df), data = iris, colour="Species", fill="Species", shape="Species", geom="points", size=2) +
  scale_color_manual(values=c("#1B9E77","#D95F02","#7570B3")) +
  scale_fill_manual(values=c("#ffffff","#ffffff","#ffffff")) +
  scale_shape_manual(values=c(21:23))
p$layers[[1]]$aes_params$stroke <- 2
p

【讨论】:

    猜你喜欢
    • 2019-03-09
    • 2019-06-02
    • 2020-01-01
    • 2017-08-22
    • 2017-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多