我有这个饼图
pie(c(1,2,1),col=c("black","white","gray"))
我想保持白色和黑色的颜色,但想要改变黑色到白色渐变的灰色,黑色扇区旁边的区域以黑色开始,然后逐渐变为灰色,然后逐渐变为灰色在到达白色扇区之前变成白色.所以灰色会被这样的东西取代:
有什么想法我怎么能这样做?任何意见,将不胜感激.
您可以将一个部分细分为多个部分,并将一个颜色从一个比例应用到每个部分.它需要为外圆绘制一条线,在圆形调用中将其删除.
# Number of intervals to subdivide - increase for finer detail n <- 41 # Generate colours cols <- colorRampPalette(c("white", "black"))(n) # Plot # lty=0 removes the section lines, which also removes outer border pie(c(1,2, rep(1/n, n)), col=c("black","white", cols) , lty=0, labels=c(1,2, rep("", n/2), 3)) # Add in outer circle back in # radius=0.8 used as this is the pie default plotrix::draw.circle( 0,0, 0.8)
这使