雷达图绘制
(1)ggplot2 简约版雷达图
library(ggplot2)
dt = data.frame(A2 = c(0, 3.33, 3.25, 2.29, 0,2.86,1.71,2.21,2.99,0),B2 = c('Cell Cycle','HIPPO','NOTCH','WNT','PI3K','RTK/RAS','NRF2','TGFβ','TP53','MYC'))
windowsFonts(myFont = windowsFont("Arial Unicode MS")) ## 绑定字体
p = ggplot(dt, aes(x = B, y = A, fill = B)) +
geom_bar(stat = "identity", alpha = 1) +
coord_polar() +
theme_bw() +
labs(x = "", y = "", title = "RF_48h") +
theme(axis.text.y = element_blank()) + ## 去掉左上角的刻度标签
theme(axis.ticks = element_blank()) + ## 去掉左上角的刻度线
theme(panel.border = element_blank()) + ## 去掉外层边框
theme(legend.position = "none") + ## 去掉图例
theme(title = element_text(vjust = -56, face = "bold", family = "myFont")) + ## 将图例移到图的下方,并更改一下字体格式
scale_fill_manual(values = terrain.colors(10))
p
(2)circular包
library(mvtnorm)
library(circular)
par(mfrow=c(2,2))
res <- windrose(sample)
breaks <- circular(seq(0,2*pi,by = pi/6))
breaks <- breaks[-2]
windrose(sample,breaks = breaks,main = "The same but with two pedals joined",shrink = res$shrink)
sample <-data. frame(dir=circular(dir, units="degrees", rotation="clock"), mag=mag)
windrose(sample, breaks=breaks, main="Change the rotation", shrink-res$shrink)
sample <-data. frame(dir=circular(dir, units="degrees", template="geographics"), mag-mag)
windrose(sample, breaks-breaks, main="Use the template ' geographics,", shrink=res$shrink)
dir <-conversion.circular(dir)