标记r雷达图的图形 #子类别价格弹性的R雷达图: #制作数据帧 SUB_CAT
使用标记r雷达图的图形 #子类别价格弹性的R雷达图: #制作数据帧 SUB_CAT,r,radar-chart,R,Radar Chart,使用axistype=1为我提供类似网格的数字 #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
axistype=1
为我提供类似网格的数字
#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)
库(fmsb)
图书馆(tidyverse)
#子类别价格弹性的R雷达图:
#制作数据帧
SUB_CAT在radarchart
的帮助下表示axistype
:轴的类型,由0:5中的任意一个指定。0表示没有轴标签。1仅表示中心轴标签。2表示仅在图表标签周围。3表示图表(外围)标签的中心和周围。4是1的。*格式,5是3的。*格式。默认值为0。但您指定的是0.5,这是不可接受的。
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)