0
I’m trying to change the layout of a radar Plot. I can’t get the chart to look like below. All attempts generated blank graphics.
The code I’m trying to modify:
# Libraries
library(fmsb)
# Create data:
set.seed(1)
dados <-as.data.frame(matrix (sample ( 0:100, 13090 , replace=T) , ncol=17, byrow=TRUE))
colnames(dados) <- c ("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17")
# To use the fmsb package, I have to add 2 lines to the dataframe: the max and min of each topic to show on the plot!
dados <- rbind(rep(100,17) , rep(0,17) , dados)
# Loop for each plot
for(i in 1:10){
png(filename = paste0('C:\\Users\\Clarice\\Pictures\\',i,'.png'))
# Custom the radarChart !
radarchart( dados[c(1,2,i+2),], axistype=1,
#custom polygon
pcol=rgb(0.2,0.3,0.5,0.9) , pfcol=rgb(0.2,0.4,0.6,0.5) , plwd=2 ,
#custom the grid
cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,50,100), cglwd=0.6,
#custom labels
vlcex=0.9,
)
dev.off()
}
Try to provide a minimum, complete and verifiable example. Remove all libraries, data and parts of the code that do not concern your doubt. Users should be able to copy and paste their code in a clean environment, run it and get to the same error, no more and no less. This is also useful for you, it is a practice that helps to detect and isolate where the problem is.
– Carlos Eduardo Lagosta