简体   繁体   中英

ggplotly error in rmarkdown

I have the following dataset:

## '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%"

Then I create a ggplot object.

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"), "")))) 

This plot runs properly. If I try this however

ggplotly(z)

I get the following error:

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. 

Any clue what might be the issue?

It appears that your use of mathematical notation via expression in the ggtitle function is causing the error. Remove the expression call and your ggplotly object should render correctly.

Related issues ( #1 , #2 ) are open on the ropensci/plotly repo on Github. Once the first issue is closed, there is some chance that mathematical notation will be supported via MathJax.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM