本文介绍了使用 with par(mfrow=c()) 在一张图中绘制多个 fill.contour 图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个由 2-3 个 filled.contour 彼此相邻的图组成的图.所有图的色标都相同,我只想要一个 z 值关键图.我很难用 par(mfrow=c(1,3))

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))

示例代码:

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)

是否可以仅使用一个 z 值颜色键将 2-3 个这些图彼此相邻堆叠?我可以在 GIMP 中做到这一点,但我想知道它是否可以在 R 中实现.

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.

推荐答案

不,我认为在 filled.contour 中这是不可能的.

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

虽然已经为您编写了扩展程序.可在此处找到这里这里此处的图例代码.[如果您正在使用这些站点上提到的 fill.contour3 函数,并且使用更新的版本,那么您需要使用此 SO 帖子].使用我生成的那些代码:

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:

这篇关于使用 with par(mfrow=c()) 在一张图中绘制多个 fill.contour 图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 14:54