是否可以使用 ggplot2 在散点图上定位星形字形?
Is it possible to locate a star glyph on a scatterplot using ggplot2?
此 R
代码输出 5 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)
我想使用 ggplot2
.
根据散点图上的 5 对 (x,y) 坐标定位每个字形
不确定如何使用 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)
此 R
代码输出 5 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)
我想使用 ggplot2
.
不确定如何使用 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)