Prometheus
Prometheus

Reputation: 2017

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?

Upvotes: 2

Views: 2888

Answers (1)

Brian
Brian

Reputation: 41

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.

Upvotes: 4

Related Questions