Polishing a web site in R: how to highlight specific areas of interest?

Using the radial.plot function in library (plotrix) (pp. 135-8) and building on a useful entry in CrossValidated , I made this spiderweb graph .

enter image description here

Question

The plot displays the average difference between the processing and the comparative group per item. However, I am particularly interested in the POSITIVE change. Therefore, I would like to single out the values> = 0. To this end, I aim to

  • color the circular line for 0-values ​​black

  • make the area for values ​​<= 0, that is, inside the 0-circle, more transparent ("lighter").

I am happy to share the code that I used to create the spiderweb plot:

items.M<-c(-0.15,0.05,0.12,-0.12,-0.02,0.27,0.53,0,-0.33,0.19,0.34) items.J<-c(-0.09,0.08,1.63,-0.1,-0.1,-0.09,0.15,0.05,-0.12,0.51,0.02) items.names<-c("item 1", "item 2", "item 3", "item 4", "item 5", "item 6", "item 7", "item 8", "item n1", "item n2", "item n3") spider.data<- rbind(items.M, items.J) library(plotrix) radial.plot(spider.data, labels=items.names, rp.type="p", radial.lim=c(-0.4,1.7), poly.col=c(rgb(255/255, 215/255, 0, .8), rgb(0, 0, 1, .8)), line.col=c("black", "black"), lwd=1) 

Many thanks for your help.

+4
source share
1 answer

For transparency, you can play with the alpha parameter of the grid package. First, I use the gridBase package to combine grid with graphics .

You will get something like this:

enter image description here

 library(gridBase) vps <- baseViewports() vp <- vps$plot vp$gp <-gpar(alpha=0.3) # you can play with alpha here pushViewport(vp) grid.circle(r=unit(vp$xscale/6,'native'), # /6 to get the small circle gp=gpar(fill='white',col='black')) upViewport() pushViewport(vps$plot) grid.circle(r=unit(vp$xscale/6,'native'), gp=gpar(fill='NA',col='black',lwd=2)) ## line width = 2 to show the black line effect upViewport() 
+3
source

All Articles