1
我需要創建方位角/距離顏色編碼圖,如下面的代碼所使用的「形狀」包。用R的「形狀」包(或其他包)繪製彩色(熱)圓形段
library(shape)
emptyplot(xlim=c(-5,10), main="color segment test case")
filledcircle(r1=1, r2=2, from=0, to=pi/6, col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.0,.0))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=1, r2=2, from=pi/6, to=2*pi/6, col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.1,.1))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=1, r2=2, from=2*pi/6, to=3*pi/6, col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.2,.2))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=1, r2=2, from=3*pi/6, to=4*pi/6, col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.3,.3))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=1, r2=2, from=4*pi/6, to=5*pi/6, col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.4,.4))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=1, r2=2, from=5*pi/6, to=6*pi/6, col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.5,.5))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=2, r2=3, from=0, to=pi/6,col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.6,.6))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=2, r2=3, from=pi/6, to=2*pi/6,col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.7,.7))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=2, r2=3, from=2*pi/6, to=3*pi/6,col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.8,.8))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=2, r2=3, from=3*pi/6, to=4*pi/6,col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.9,.9))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=2, r2=3, from=4*pi/6, to=5*pi/6,col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.99,.99))), zlim=c(0,1), mid=c(0.0,0.0))
filledcircle(r1=2, r2=3, from=5*pi/6, to=6*pi/6,col=intpalette(c("blue", "yellow","red"), numcol = 100),
val=(cbind(c(0,1),c(.8,.8))), zlim=c(0,1), mid=c(0.0,0.0))
segments(0,0,3,0)
segments(0,0,2.6,1.5)
segments(0,0,1.5,2.6)
segments(0,0,0,3)
segments(0,0,-1.5,2.6)
segments(0,0,-2.6,1.5)
segments(0,0,-3,0)
plotcircle(r=1, from=0, to=pi, lwd=1)
plotcircle(r=2, from=0, to=pi, lwd=1)
plotcircle(r=3, from=0, to=pi, lwd=1)
該地塊的現實世界的例子就需要一些十個或更多的半徑和可能需要情節的另一半,甚至可能更精細的方位角範圍。這將需要數十和數十行代碼。
這個圖類似於風玫瑰圖,各種R包(一個爲氣候圖)都有類似的功能,但沒有完全一樣的情節。我查看了CircStats,通告,NeatMap,ggplot2和climatol,但似乎沒有任何東西符合法案。
有誰知道另一個R軟件包,可以通過給它提供一個數據框或一個數字矩陣和一個調色板定義來創建這種情節?
Andrie,我看到了136頁和哈德利的GGPLOT2書137上的參考,以極座標,但137頁的顯示例子沒有給你作爲一種可能性的例子,所以我沒有再看。我得看看更進一步。謝謝。 – Plsvn