I'm using the package radarchart in R to make radar plots and I would like to change the color and the linewith of the data's lines. But I don't know how to do. Maybe there is an argument calling "colMatrix", but I don't know how to use it.
Here a short sample of the code :
labels = c("1", "2", "3", "4", "5")
data1 = data.frame("A" = c(0.6, 0.5, 0.2, 0.9, 0.2))
data2 = data.frame("B" = c(0.5, 0.1, 0.9, 0.8, 0.3))
data3 = data.frame("C" = c(0.6, 0.6, 0.5, 0.7, 0.5))
chartJSRadar(scores=c(data1,data2, data3), labs=labels, polyAlpha=0, showLegend=F, maxScale=1)
When running the last line, the plot automatically uses 3 differents color for each data.
But when plotting only one like this :
chartJSRadar(scores=data1, labs=labels)
It uses red by default and I want to use another color (for others radar plots) like this :
Hope someone knows. Same for linewidth.
For what it's worth.. I find the col2rgb function quite handy for converting to RGB colours.
library(radarchart)
c <- grDevices::col2rgb(c("orange","green", "black"))
labels = c("1", "2", "3", "4", "5")
data1 = data.frame("A" = c(0.6, 0.5, 0.2, 0.9, 0.2))
data2 = data.frame("B" = c(0.5, 0.1, 0.9, 0.8, 0.3))
data3 = data.frame("C" = c(0.6, 0.6, 0.5, 0.7, 0.5))
chartJSRadar(scores=c(data1,data2, data3), labs=labels, polyAlpha=0, showLegend=F, maxScale=1, colMatrix = c)
Same rules apply though, if there are more data series than colours they will get re-used.
I'm not sure about the line width though. After checking the chartjs docs ( http://www.chartjs.org/docs/#radar-chart-chart-options), I thought it would be the borderWidth option but I couldn't get it to work.