guide_colorbar上的ggplotly错误“未找到对象'tickvals'”

时间:2019-08-26 16:12:47

标签: r ggplot2 ggplotly

我正在尝试使用ggplotly与一些geom_ribbon进行交互式绘图。

图看起来像(使用tidyverse包制作的数据):

temp_data <-
   tibble(Group = 1, x = 1) %>%
   complete(Group = 1:3, x = 1:10) %>%
   mutate(y_val = x + Group * 5
          , ymin = y_val - 3/Group
          , ymax = y_val + 3/Group)

temp_plot <-
    ggplot(temp_data
           , aes(x = x
                 , ymin = ymin
                 , ymax = ymax
                 , fill = Group
                 , group = Group)) +
    geom_ribbon()

情节如下:

enter image description here

我想要哪个情节。但是,当我使用plotlyggplot(temp_plot)中进行渲染时,出现错误:

  

eval(substitute(expr),data,enclos = parent.frame())错误:
  找不到“ tickvals”对象

我可以追踪到geom_ribbon元素,尤其是图例。如果我运行ggplotly(temp_plot + theme(legend.position = "none")),则绘图可以正常渲染(没有图例)。

我正在运行ggplot2(ggplot2_3.2.0.9000)和plotly(plotly_4.9.0)的最新稳定版本。值得注意的是,在运行旧版本ggplot2(ggplot2_3.1.1)的服务器上,我确实得到此错误,但是该服务器是plotly上的最新版本。

0 个答案:

没有答案