Reputation: 2081
This R
code outputs 5 star glyphs
but I can't control their location:
stars(mtcars[1:5, 1:4], key.loc = c(6, 0.5),
main = "Example of 4 glyph stars", labels= NULL, flip.labels = FALSE)
I want to position each glyph according to 5 pairs of (x,y) coordinates on a scatterplot using ggplot2
.
Upvotes: 0
Views: 168
Reputation: 307
Not sure how to do it using ggplot, but stars
has the capability to control the location by using locations
. See below:
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)
Upvotes: 1