将上部和下限设置为绘制的矩阵中绘制的值。matrix

发布于 2025-02-12 21:31:05 字数 858 浏览 2 评论 0原文

我正在尝试绘制矩阵的值,并且需要使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆离笙 2025-02-19 21:31:05

您可以使用break参数手动设置限制:

plot(a, breaks=c(0,10))

”在此处输入图像描述”

甚至设置所有个人断裂:

plot(a, breaks=c(0,2.5,5,7.5,10))

”在此处输入图像描述”

You can use the breaks argument to set the limits manually:

plot(a, breaks=c(0,10))

enter image description here

Or even to set all the individual breaks:

plot(a, breaks=c(0,2.5,5,7.5,10))

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文