代码之家  ›  专栏  ›  技术社区  ›  sbac

是否可以使用ggplot2在散点图上定位星字形?

  •  0
  • sbac  · 技术社区  · 8 年前

    R star glyphs

    stars(mtcars[1:5, 1:4], key.loc = c(6, 0.5),
          main = "Example of 4 glyph stars", labels= NULL, flip.labels = FALSE)
    

    我想根据散射图上的5对(x,y)坐标定位每个字形,使用 ggplot2 .

    1 回复  |  直到 8 年前
        1
  •  1
  •   Brian Balzar    8 年前

    不知道如何使用ggplot,但是 stars 有能力通过使用 locations

    x_s <- 1:5
    y_s <- 1:5
    loc <- data.frame(x = x_s, y = y_s)
    
    stars(mtcars[1:5, 1:4], key.loc = c(5, 0), locations = loc,
      main = "Example of 4 glyph stars", labels = NULL, flip.labels = FALSE)