plotly / plotly.R

An interactive graphing library for R
https://plotly-r.com
Other
2.56k stars 626 forks source link

Call for feature: supporting of expressions #1091

Open bioinformatist opened 7 years ago

bioinformatist commented 7 years ago

When I try use expression object as lab labels, ggplotly raises an error.

p <- ggplot(data=de$table, aes(x=logFC, y=-log10(PValue), colour=threshold)) +
        geom_point(size=1.75, alpha = 0.4) +
        # ylim(c(0, input$ylmslider)) +
        xlab(expression("log"[2]*"(Fold Change)")) + ylab(expression("-log"[10]*"(p-value)")) +
        geom_vline(xintercept = 0, colour = "grey",
  linetype = "dashed", size = 2) + # add line at 0
        geom_hline(yintercept = -log10(0.05), colour = "grey",
  linetype = "dashed", size = 2) + theme(legend.position = "none") # p(0.05) = 1.3
#> Everything is ok up to now
ggplotly(p)
#> Error in unique.default(x) : unimplemented type 'expression' in 'HashTableSetup'

You can reproduce this scenario by using any expression as axis titles.

cpsievert commented 7 years ago

This is a hard problem which I've looked into -- http://rpubs.com/cpsievert/268872

It seems this is going to take a lot of effort that won't be worth it, but once #375 is closed, you'll be able to write TeX, which one could argue is better https://robjhyndman.com/hyndsight/latex2exp/

baderstine commented 5 years ago

ah, had same exact error attempting to make same plot labels! Fold Change vs. negative log p-value is the 'volcano plot'.

DarioS commented 1 week ago

Could the error message be improved, at least? It does not give the user a clear indication of what is wrong.

Error in unique.default(x) : 
  unimplemented type 'expression' in 'duplicated'