雷達(dá)圖繪制
(1)ggplot2?簡(jiǎn)約版雷達(dá)圖
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()) +????## 去掉左上角的刻度標(biāo)簽
??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)