Manual frame colors

I paint some surfaces in R using a grid package. I can not find a way to choose surface colors. Here is an example:

enter image description here

Here is an example of how I draw each:

theseCol=heat.colors(150) mm=paste("WB numbers where present\n(",nstoch," sims)",sep="") WBnumbers=wbPrev_series rownames(WBnumbers)=KList colnames(WBnumbers)=iMwbList wireframe(WBnumbers, zlim=c(0,max(wbPrev_series,na.rm=TRUE)), colorkey=FALSE, col.regions=theseCol, scales = list(arrows = FALSE), drape = TRUE, main=mm, zlab="", xlab="K", ylab="iMwb") 

I would like the first surface to be what it is, but for the rest, the color is not at the z levels, but at the 1st surface z levels. I tried several things, but the wireframe always accepts the colors that I give as possible ranges for the current variable.

Anyway, can this be done? Thanks

+6
source share
1 answer

Here is the answer Dave W. posted a few years ago on the R-help mailing list. You can probably enable the whole stream in google.

From: David Winsemius Following the wirefrane help tips, you need to look at the levelplot for advice re: the correct specification for colorkey
and follow the relevant links on the help pages. Be your data
is the correct entry into the framework; it cannot be determined from the information included, although, I believe, your stated success indicates that this is so.

This has not been verified (since there was nothing to test) after reading the material I pointed out:

 wireframe(data.m,aspect = c(0.3), shade=TRUE, screen = list(z = 0, x = -45), light.source = c(0,0,10), distance = 0.2,zlab="Freq",xlab="base",ylab="Fragment", col=level.colors(x, at = do.breaks(range(data.m), 30), col.regions = colorRampPalette(c("red", "white", "blue")(30)) ) 

EDIT: At Josh's request, I played a little. Below will be applied color scheme (drapery):

 wireframe(dmat,drape=TRUE,col='black',col.regions = colorRampPalette(c("red", "white", "blue"))(30) ) 

Which sets the drape colors, but not the grids themselves. It's embarrassing that wireframe does not respect par(new=TRUE) , because if that were the case, we could cut the data matrix into z-ranges and remodel one color at a time.

I will have to check my "archive" of old experiments with R / R graphics when I get home, but I think that in the end I used the scatterplot3d package to get the grid colors depending on the data.

+2
source

Source: https://habr.com/ru/post/945696/


All Articles