在此示例中,我无法反转轴。我想从图中间的8开始,然后在顶部的1开始。目前中间是0,结束是8.
library(fmsb)
创建数据:高中为Jonathan注意:
data=as.data.frame(matrix( sample( 1:8 , 10 , replace=T) , ncol=10))
colnames(data)=c("math" , "english" , "biology" , "music" , "R-coding", "data-viz" , "french" , "physic", "statistic", "sport" )
要使用fmsb软件包,我必须在数据框中添加2行:每个主题的最大值和最小值,以便在图中显示!
data=rbind(rep(8,1) , rep(1,1) , data)
图书馆提出的默认雷达图表:
radarchart(data)
自定义radarChart!
radarchart( data , axistype=1 ,
#custom polygon
pcol=rgb(0.2,0.5,0.5,0.9) , pfcol=rgb(0.2,0.5,0.5,0.5) , plwd=4 ,
#custom the grid
cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,8,2), cglwd=0.8,
#custom labels
vlcex=0.8
)
答案 0 :(得分:0)
您似乎只想为偶数值设置标记,但是您不会将1作为轴标记。我将从8变为0,而不是从8变为1.您需要做的就是反转您指定的轴限制并反转轴标签。
data=as.data.frame(matrix( sample( 1:8 , 10 , replace=T) , ncol=10))
colnames(data)=c("math" , "english" , "biology" , "music" ,
"R-coding", "data-viz" , "french" , "physic", "statistic", "sport" )
## Changes lower limit to 0
data=rbind(rep(8,1) , rep(0,1) , data)
radarchart(data)
## Reverse max and min (how points will be plotted)
data2 = data
data2[1:2,] = data2[2:1,]
radarchart( data2, axistype=1 ,
#custom polygon
pcol=rgb(0.2,0.5,0.5,0.9) , pfcol=rgb(0.2,0.5,0.5,0.5) , plwd=4 ,
#custom the grid
cglcol="grey", cglty=1, axislabcol="grey",
# Reverse axis labeling
caxislabels=seq(8,0,-2), cglwd=0.8,
#custom labels
vlcex=0.8
)