Graphic plot in grayscale in R

I draw a plot of the overlaid area in R using the command stackpoly()in the plotrix package. By default, colors are vibrant, to say the least. Is there a way to use characters or shades of gray instead?

+3
source share
1 answer

From ?stackpoly:

 col: Color to fill the polygons. If NULL, ‘rainbow’ will be called
      to generate the colors. If NA, the polygons will not be
      filled.

Modify the example slightly in ?stackpoly:

stackpoly(matrix(cumsum(testx),nrow=10),main="Test Stackpoly I",
   xaxlab=c("One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten"),
  border="black",staxx=TRUE,
col=gray(seq(0.1,0.9,length=10)))

enter image description here

+10
source

All Articles