【问题标题】:geom_GeomLabel() has yet to be implemented in plotlygeom_GeomLabel() 尚未在 plotly 中实现
【发布时间】:2018-10-31 06:18:05
【问题描述】:

将 ggplot 转换为 plotyly 时出现此错误。 必须做什么?

我的代码:

p  <- ggplot(data_, aes(data_$dates,group = 1)) +
      geom_point(aes(y = data_$exp))+
      geom_point(aes(y = data_$actual))+
      geom_line(aes(y = data_$exp, color='Expected')) + 
      geom_line(aes(y = data_$actual, color='Actual'))+
      geom_label(aes(y = data_$exp,label = data_$exp,hjust = 0,vjust = -0.2))+
      geom_label(aes(y = data_$actual,label = data_$actual,hjust = 0,vjust = 0.2 ))+
      labs(title = "Avail")+
      labs(x="Dates")+
      labs(y="")+
      guides(color = guide_legend(title = ""))

output$trendPlot <- renderPlotly({
 ggplotly(p)
  })

我得到的错误:

geom_GeomLabel() has yet to be implemented in plotly.
  If you'd like to see this geom implemented,
  Please open an issue with your example code at
  https://github.com/ropensci/plotly/issues
Warning in origRenderFunc() :
  Ignoring explicitly provided widget ID "85055e160099"; Shiny doesn't use them

【问题讨论】:

    标签: r dataframe ggplot2 plotly


    【解决方案1】:

    错误表示此时plotly 无法处理来自ggplot2geom_label。正如错误提示的那样,可以做的一件事是在https://github.com/ropensci/plotly/issues 上打开一个问题。但是,碰巧geom_text 确实有效,因此用它替换geom_label 将是最简单的解决方案。

    【讨论】:

    • @qwww,它回答了你的问题吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-13
    • 2012-05-18
    • 2017-02-22
    • 2016-10-06
    • 2021-12-28
    • 2018-03-04
    • 2011-07-29
    相关资源
    最近更新 更多