【问题标题】:sunflowerplot legend symbol with the correct number of segment具有正确段数的向日葵图例符号
【发布时间】:2014-06-03 15:21:49
【问题描述】:

我希望为 R 中的 sunflowerplot 创建一个好的图例,其中包含正确数量的“petals”的多个叶子的符号。

petals”是在函数sunflowerplot中由不同角度的段创建的。 可以重新创建带有一些段的图形,但您知道是否可以在图例中插入自创符号?或者你有没有找到一个解决方案,在sunflowerplot 函数的图中用petals 绘制的不同级别创建一个图例符号。

dat <- structure(c(0, 0, 0, 0.074, 0.074, 0.074, 0.22, 0.22, 0.22, 0.66, 
 0.66, 0.66, 18, 19, 19, 19, 19, 18, 16, 16, 18, 3, 3, 3), .Dim = c(12L, 
 2L))
sunflowerplot(dat[, 1], dat[, 2])
legend("right", c("1 rep", "4 rep", "8 rep"), pch = c(16, 3, 8))

我知道在图例中可以使用pch 48,但我不太同意这种方法。

【问题讨论】:

    标签: r graphics legend


    【解决方案1】:

    好的,我的解决方案是不使用 sunflowerplot 函数,而是根据 sunflowerplot 代码创建我自己的函数。

    第一步:计算每个坐标的点数

    tt

    第 2 步:绘制 tt 对象

    绘图(tt$x,tt$y,cex = tt$number,pch = 16)

    第 3 步:仅为现有点添加图例

    legend("topright", pt.cex = sort(unique(tt$number)), pch = rep(16, length(unique(tt$number))), legend = paste(sort(unique(tt$) number)), "replic.", sep = " "), bty = "n")

    【讨论】:

      猜你喜欢
      • 2013-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多