bokeh / rbokeh

R interface to Bokeh http://hafen.github.io/rbokeh/
Other
313 stars 66 forks source link

LaTeX or expressions in figure labels #250

Closed agilly closed 1 year ago

agilly commented 1 year ago

Is there a way to provide either LaTeX expressions or R expressions to figure so as to have nicer labels? The below example is for an axis label but I presume the same is true for main or text added to plots:

library(rbokeh)
p=figure(height=500, width=950, xlab="abscissa", xaxes=F, ylab=expression("-log"[10]*"(p)"))
p=ly_points(p, ...)
p

In jupyter notebook this fails to render with an endless waiting wheel.

agilly commented 1 year ago

closing as rbokeh no longer maintained.

bryevdv commented 1 year ago

FWIW I would love to see RBokeh picked back up, and I would be happy to help however I can from the Bokeh/BokehJS side, but for sure the effort would need to be led by someone firmly in the R world already (i.e. not me). I also think @hafen had some WIP work to automatically derive the models layer, but for some reason I don't think it ever got pushed. @hafen can you at least push that work, however WIP or exploratory, to some branch here?

hafen commented 1 year ago

I too would love to see this revived.

The work that @bryevdv referred to is here: https://github.com/hafen/rbokeh/tree/v0.6.6

This code takes the Bokeh json spec and turns it into R code, providing an R6 class representation of all of the Bokeh models, with lots of tests to ensure that once populated in R they get serialized back to json properly. So all the legwork is there to construct a Bokeh plot through a lower-level approach of assembling the appropriate pieces of the model. Tying this into the higher-level interface more familiar to R users while providing maximum flexibility and maintaining compatibility with the old package proved to be challenging with the time constraints I had.

Given that it's been so long, perhaps a reimagining of the higher-level interface plugged directly into this new model would not hamstring the work as much.

The R6 translation got pretty technical. I'm happy to revisit that and see if it still hold up to the latest Bokeh spec. That hopefully wouldn't require too much time. I can also provide examples of how that can be used to put together plot specs at the lower level. I think it's the high-level interface that needs a lot of thought and consideration and polish to ensure R users have a good experience.

hafen commented 1 year ago

I should add that beyond reviving the model generation and providing a good footing for something potentially new to be built on top of it, I could be available for guidance, etc. This is all provided that there is someone who has interest and has more time to really dive in.

bryevdv commented 1 year ago

Thanks for the clarification about the branch @hafen

I'm happy to revisit that and see if it still hold up to the latest Bokeh spec.

That would be super helpful, although I notice we removed the spec.py script at some point (probably it got broken a some point) so there would be some effort on our end to restore a JSON-spec generator as well.

agilly commented 1 year ago

Wow thanks @bryevdv and @hafen for responding! From a R user perspective it would be awesome to see rbokeh revived, as the interactive plotting space for R is currently occupied almost solely by plot.ly which has several drawbacks. I used bokeh for python several times and love the library, but I am maintaining an R shiny project now so bokeh is unfortunately not an option.