Multiple filled.contour plots in one graph using with par(mfrow=c())

时间秒杀一切 提交于 2019-11-27 15:16:03

问题


I am trying to construct a graph consisting of 2-3 filled.contour plots next to each other. The color scale is the same for all plots, and I would like only one z value key plot. I am having difficulties to do this with par(mfrow=c(1,3))

Example code:

x <- 1:5
y <- 1:5
z <- matrix(outer(x,y,"+"),nrow=5)
filled.contour(x,y,z)
filled.contour(x,y,z,color.palette=rainbow)
z2 <- z
z2[5,5] <- Inf
filled.contour(x,y,z2,col=rainbow(200),nlevels=200)

Is it possible to stack 2-3 of these plots next to each other with only one z value color key? I can do this in GIMP but I was wondering if it is natively in R possible.


回答1:


No I do not think this is possible in filled.contour.

Although extensions have been written for you already. To be found here, here and here and a legend code here. [If you are using the filled.contour3 function referred to on those sites, and using a more recent version, then you need to use the upgrade fix referred to in this SO post]. Using those codes I produced:



来源:https://stackoverflow.com/questions/14758391/multiple-filled-contour-plots-in-one-graph-using-with-parmfrow-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!