问题描述
我正在尝试基于基于此 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()
解决方法
根据文档,shareY
参数告诉函数是否在子图之间共享 y 轴。
试试这个:
autoplotly(lm.plot,shareY = FALSE)
但是,目前代码中有一个错字 -- https://github.com/terrytangyuan/autoplotly/pull/6 这意味着您需要运行:
autoplotly(lm.plot,shareX = FALSE)