将上部和下限设置为绘制的矩阵中绘制的值。matrix
我正在尝试绘制矩阵的值,并且需要使用library(plot.matrix)
进行操作。我的问题是,某些矩阵具有极高的值,这些值偏向图,并且不允许我以图形方式观察非外部词的值的差异。
为了说明这一点,想象一下我想绘制以下矩阵:
> a <- matrix(1:9, nrow=3, byrow=TRUE)
> a[1,3] <- 1000
> a
[,1] [,2] [,3]
[1,] 1 2 1000
[2,] 4 5 6
[3,] 7 8 9
因此,我想避免在绘制矩阵时考虑a [1,3]
值(我不希望在定义调色板或其他情节设置的断裂)。
检查文档后 https://cran.r-project.org/web/packages/plot.matrix/vignettes/vignettes/plot.matrix.htmli 没有找到直接允许我的函数plot.matrix的任何参数定义要绘制的值范围 - 类似于x.lim或y.lim的论点。
尽管我已经还有其他一些解决方案:
- 重新定义矩阵替换这些值
na
- 使用空白的适当定义,但
我想知道是否有任何直接论证fuction plot(...)
可以直接执行此操作。
I am trying to plot the values of a matrix and I need to do it using the library(plot.matrix)
. My problem is that some of the matrix have extremely high values which bias the plot and do not allow me to observe graphically the differences of the non-outliers' values.
To illustrate this, imagine I want to plot the following matrix:
> a <- matrix(1:9, nrow=3, byrow=TRUE)
> a[1,3] <- 1000
> a
[,1] [,2] [,3]
[1,] 1 2 1000
[2,] 4 5 6
[3,] 7 8 9
Therefore, I would like to avoid considering the a[1,3]
value when plotting the matrix (I do not want it to be considered when defining the breaks of the palette or other plot settings).
After checking the documentation https://cran.r-project.org/web/packages/plot.matrix/vignettes/plot.matrix.htmlI did not find any argument for the function plot plot.matrix which directly allows me to define the range of values to plot - something similar to the x.lim or y.lim arguments.
Although I already have some other solutions:
- Redefine the matrix substituting these values for
NA
- Use an adequate definition of breaks
I was wondering if there is any direct argument to the fuction plot(...)
that allows me to do this directly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
break
参数手动设置限制:甚至设置所有个人断裂:
You can use the
breaks
argument to set the limits manually:Or even to set all the individual breaks: