Home > database >  Creating my own spider chart in R without using any libraries
Creating my own spider chart in R without using any libraries

Time:12-15

I need to create something like a spider chart in R without using any libraries. That’s my code for now. It creates a figure with points number equal to the length of vector ‘a’. However, I’d like each point to be at the distance from the coordinates center equal to a respective number in a vector, for example one point at a distance 1, another at 2, so on. Is it possible to do so?

    a <- 1:6
    angle <- seq(0, 2*pi, (2*pi)/length(a))
    x <- cos(angle)
    y <- sin(angle)
    plot(x, y, 
         type = "l")

my plot

CodePudding user response:

See ?stars:

a <- 1:6
stars(matrix(a, nrow=1), scale=FALSE)

enter image description here

For future reference, using R's built-in help search would have found this with ??spider

  • Related