[英]label the graph for r radar graph
#R-radar map for sub-categories price-elasticity:
#Make data frame
SUB_CAT <- c("PRETZEL","PIZZA","ADULT CEREAL", "FAMILY CEREAL", "MOUTHWASH", "MOUTHWASH(ANTISEPTIC)", "KIDS CEREAL")
Max <- c(2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5)
Min <- c(0,0,0,0,0,0,0)
Price_elasticity <- c(1.512, 1.392, 0.3675, 0.2229, 1.2, 0.4676, 2.317)
PE<- data.frame(SUB_CAT,Max, Min, Price_elasticity)
#Make radar chart
M<-PE %>%
pivot_longer(cols = -SUB_CAT) %>%
pivot_wider(names_from = SUB_CAT, values_from = value) %>%
column_to_rownames("name")
radarchart( M , axistype=0.5 ,
#custom polygon
pcol=rgb(0.2,0.5,0.5,0.9) , pfcol=rgb(0.2,0.5,0.5,0.5), plwd=5 ,
#custom the grid
cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,3,0.7), cglwd=0.8,
#custom labels
vlcex=0.5)
I made this radar graph, but for some reason, the numbers for the grid is not showing up.我制作了这个雷达图,但由于某种原因,网格的数字没有显示出来。
I had the same code for both, I think but when I try it again my labels are just gone, what is wrong with my code?我对两者都有相同的代码,我想但是当我再次尝试时,我的标签消失了,我的代码有什么问题?
Using axistype=1
giving me the numbers for the grid like使用axistype=1
给我网格的数字,比如
library(fmsb)
library(tidyverse)
#R-radar map for sub-categories price-elasticity:
#Make data frame
SUB_CAT <- c("PRETZEL","PIZZA","ADULT CEREAL", "FAMILY CEREAL", "MOUTHWASH", "MOUTHWASH(ANTISEPTIC)", "KIDS CEREAL")
Max <- c(2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5)
Min <- c(0,0,0,0,0,0,0)
Price_elasticity <- c(1.512, 1.392, 0.3675, 0.2229, 1.2, 0.4676, 2.317)
PE<- data.frame(SUB_CAT,Max, Min, Price_elasticity)
#Make radar chart
M<-PE %>%
pivot_longer(cols = -SUB_CAT) %>%
pivot_wider(names_from = SUB_CAT, values_from = value) %>%
column_to_rownames("name")
radarchart(M, 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=2,
#custom the grid
cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,3,0.5), cglwd=0.8,
#custom labels
vlcex=0.5)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.