【问题标题】:ggplotly error in rmarkdownrmarkdown中的ggplotly错误
【发布时间】:2017-05-05 08:58:12
【问题描述】:

我有以下数据集:

## 'data.frame':    2 obs. of  3 variables:
##  $ Var1     : Factor w/ 2 levels "correct","incorrect": 1 2
##  $ Freq     : num  84 16
##  $ text_bars: chr  "84%" "16%"

然后我创建一个 ggplot 对象。

z <- ggplot(results_graph, aes(Var1, Freq)) +
  geom_bar(position="dodge",stat="identity", fill = "deepskyblue4") +
  #coord_flip() +
  theme(legend.title=element_blank()) +
  ggtitle(expression(atop(bold("Percent of correct vs. incorrect numbers"),    
                          atop(italic("test_test"), "")))) 

这个情节运行正常。但是,如果我尝试这样做

ggplotly(z)

我收到以下错误:

Error in unique.default(proposed[[attr]]): unimplemented type 'expression' in 'HashTablesetup' Calls: <Anonymous> ... verify)attr -> structure -> uniaue -> uniaue.default In addition: Warning message: In instance$preRenderHook(instance): It seems your data is too big for client-side DataTables. 

任何线索可能是什么问题?

【问题讨论】:

  • 您也可以添加数据吗?这样我们就可以直接尝试您的代码?谢谢。
  • 它已经附在问题中。不知道你的意思。

标签: r ggplot2 markdown htmlwidgets


【解决方案1】:

看来您在ggtitle 函数中通过expression 使用数学符号会导致错误。删除 expression 调用,您的 ggplotly 对象应该会正确呈现。

相关问题(#1#2)在 Github 上的ropensci/plotly repo 上开放。一旦第一个问题关闭,就有可能通过 MathJax 支持数学符号。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-03-06
    • 2020-06-26
    • 1970-01-01
    • 2016-10-27
    • 2014-10-12
    • 2020-06-05
    • 2023-03-28
    相关资源
    最近更新 更多