使用自动绘图为线性模型上使用的 ggfortify 对象生成交互式绘图

问题描述

我正在尝试基于基于此 data 的多元回归模型为 ggfortify 对象生成交互式绘图。以下是我到目前为止所做的。如何使用 ggfortify 为这个 autoplotly 对象生成交互式绘图?

library(ggfortify)
library(autoplotly)

# Construct a simple multivariate regression model 
# So it's something like this SWE ~ Mean.Z + Intensity.mean

Model = lm(formula = SWE ~ Mean.Z + Intensity.mean,data = df.mean.swe)

# Plot the model
lm.plot = autoplot(Model,label.size = 3) + theme_bw()

# Interactive
autoplotly(lm.plot)

Error in unique.default(x) : 
  unimplemented type 'expression' in 'HashTableSetup'

更新

好的,所以我能够通过首先指定要强化的感兴趣的地块来解决问题。不过,我不知道为什么现在错误消失了。

lm.plot = autoplot(Model,label.size = 3,which = 1:2) + theme_bw()

enter image description here

但现在 autoplotly 没有正确显示 Q-Q 图。

enter image description here

解决方法

根据文档,shareY 参数告诉函数是否在子图之间共享 y 轴。

试试这个:

autoplotly(lm.plot,shareY = FALSE)

但是,目前代码中有一个错字 -- https://github.com/terrytangyuan/autoplotly/pull/6 这意味着您需要运行:

autoplotly(lm.plot,shareX = FALSE)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...