rmarkdown中的ggplotly错误

时间:2017-05-05 08:58:12

标签: r ggplot2 markdown htmlwidgets

我有以下数据集:

## '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. 

有什么问题可能是什么问题?

1 个答案:

答案 0 :(得分:2)

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

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

相关问题