Reputation: 91010
I have a 5x7 matrix I want to plot as a radar or spider chart? For example:
stars(mtcars[, 1:7], locations = c(0,0), radius = FALSE,
key.loc=c(0,0), main="Motor Trend Cars", lty = 2)
I'd like each of these lines to be a different color (and/or different style) so I can make out what I'm looking at.
Upvotes: 1
Views: 3983
Reputation: 7023
The following suggestion is a bit of a hack. I'm sure a more elegant solution is possible.
stars
, and make a copy: let's call it stars2
stars2
argument list: col.lines = NULL
polygon(s.x[i, ], s.y[i, ], lwd = lwd, lty = lty, col = col.stars[i])
to polygon(s.x[i, ], s.y[i, ], lwd = lwd, lty = lty, border = col.lines[i], col = col.stars[i])
stars2
providing a color for each of your stars.The sample call and output (left = before, right = after) are below.
stars2(mtcars[, 1:7], locations = c(0,0), radius = FALSE,key.loc=c(0,0),
main="Motor Trend Cars", lty = 2,col.lines = 1:nrow(mtcars))
Upvotes: 6