I am trying to change the colors of the 3d bar plot so that the colors go from green, to yellow, to orange, to light red, to red, to dark red. However, whenever I plot it, it looks like the colors start repeating after green. Is there something, I can do to fix this? The output that I get is:
The output that I want is this:
enter image description here
This is the code, I am using. It gives me the first picture. That is not what want. I want the colors to look the way they look in the second picture.
library(latticeExtra)
myPalette <- colorRampPalette(rev(c("red2","tomato2","red4","orange", "gold1","forestgreen")))(6)
k <- read.table(text = 'x y z
NotKnown 0 Critical
NotKnown 0 Substantial
NotKnown 0 Significant
NotKnown 0 Moderate
NotKnown 0 Negligible
NotLikely 2 Critical
NotLikely 5 Substantial
NotLikely 7 Significant
NotLikely 0 Moderate
NotLikely 0 Negligible
Reasonable 0 Critical
Reasonable 1 Substantial
Reasonable 9 Significant
Reasonable 1 Moderate
Reasonable 0 Negligible
Likely 0 Critical
Likely 0 Substantial
Likely 1 Significant
Likely 0 Moderate
Likely 0 Negligible
VeryLikely 0 Critical
VeryLikely 0 Substantial
VeryLikely 0 Significant
VeryLikely 0 Moderate
VeryLikely 0 Negligible',header=TRUE)
k$x <- factor(k$x,levels = c("VeryLikely", "Likely","Reasonable","NotLikely","NotKnown"))
k$z <- factor(k$z,levels= c("Critical","Substantial","Significant","Moderate","Negligible"))
cloud(y~z+x, k, panel.3d.cloud=panel.3dbars, col.facet=myPalette,
xbase=0.8, ybase=0.8, xlab= "Severity",ylab="Probability",zlab="Number of Risks",scales=list(arrows=FALSE, col=1),
par.settings = list(axis.line = list(col = "transparent")))
question from:
https://stackoverflow.com/questions/65837568/r-adjust-color-gradient-for-3dbarplot-using-latticeextra-cloud-in-r 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…