设置plot.PCA的轴限制-奇怪的行为(FactoMineR) [英] Set axis limits for plot.PCA - strange behaviour (FactoMineR)

查看:154
本文介绍了设置plot.PCA的轴限制-奇怪的行为(FactoMineR)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用制造商软件包来绘制PCA的结果.当绘制一个PCA时,优良作法是调整图形的大小,以使其高/低比例与每个轴所解释的%方差成比例.

I want to plot the result of a PCA with the package factominer. When one plots a PCA it is good practice to resize the graph so that its H/L ratio is in proportion to the %variance explained by each axis.

因此,我首先尝试仅通过拉伸窗口来调整图形大小:它显然会失败,并将点保持在中间,而不是也拉伸它们.

So I tried first to resize the graph simply by stretching the window: it obviously fails and keep the points in the middle instead of stretching them too.

library(FactoMineR)
out <- PCA(mtcars)

然后我尝试强制将xlimylim参数固定为(?plot.PCA)

Then I try to force the xlim and ylim arguments to be fixed (?plot.PCA)

plot.PCA(out, choix="ind", xlim=c(-6,6), ylim=c(-4, 4))

同样的问题,xlim限制没有得到遵守...

Same problem, the xlim limits are not respected...

有人可以解释这种行为,知道如何解决吗?

Can someone explain this behaviour and knows how to fix it?

推荐答案

您看到的是在plot.PCA中调用plot的结果:

What you're seeing is the result of the call to plot inside plot.PCA:

plot(0, 0, main = titre, xlab = lab.x, ylab = lab.y, 
     xlim = xlim, ylim = ylim, col = "white", asp = 1, ...)

在参数asp设置为1的情况下调用

plot,这保证了 y/x 的比率保持不变,因此,当您尝试调整窗口大小时,被重新计算.

plot is called with parameter asp set to 1, which guarantees that the y/x ratio stays the same, so when you try to resize the window, the xlim are recomputed.

plot.window中,您可以找到asp的含义":

In plot.window you can find the "meaning" of asp:

如果asp是一个有限的正值,则设置窗口,以使x方向上的一个数据单元的长度等于asp * y方向上的一个数据单元的长度.

If asp is a finite positive value then the window is set up so that one data unit in the x direction is equal in length to asp * one data unit in the y direction.

您可以尝试

plot(0, 0, main = "", xlab = "", ylab = "", xlim = c(-6, 6), ylim = c(-4, 4), col = "white", asp = 1)

并调整窗口大小,然后与

and resizing the window, and then the same with

plot(0, 0, main = "", xlab = "", ylab = "", xlim = c(-6, 6), ylim = c(-4, 4), col = "white")

看看有什么区别.

这篇关于设置plot.PCA的轴限制-奇怪的行为(FactoMineR)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆