question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Latex label compatibility issues while using Bokeh as backend

See original GitHub issue

Describe the bug I want to use latex for my labels and so I use the following line of code.

import arviz.labels as azl
labeller = azl.MapLabeller(var_name_map={"Cxf": r"$\C_{xf}$","Cxr": r"$C_{xr}$"})
`

However, when I plot the posterior using “Bokeh” as backend using ax_post = az.plot_posterior(idata,backend = "Bokeh",figsize = (12,8),labeller=labeller) I get this bug_post

To Reproduce The bug can be reproduced with the attached data file and the above lines of code. https://drive.google.com/file/d/1Kld1u4VaGWYVz5Yq9GClUFaGDhFIfLhF/view?usp=sharing

Expected behavior This problem does not exist when I use matplotlib as my backend. See plots below bug2_post

Additional context arviz version - 0.12.0 bokeh version - 2.4.2

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
OriolAbrilcommented, Jun 5, 2022

I think for latex in bokeh you need to use different delimiters like double dollar sign. Can you try it?

More info at https://docs.bokeh.org/en/2.4.3/docs/user_guide/styling.html#latex

0reactions
OriolAbrilcommented, Jul 26, 2022

@agustinaarroyuelo and I (but mostly Agustina) investigated the issue. Bokeh 2.x only supports latex rendering on the elements explicitly listed in the documentation. That is:

(emphasis mine) Currently, you can use LaTeX and MathML notations with axis labels and tick labels using major_label_overrides(). You can also use LaTeX with div or paragraph widgets.

The examples in the docs restrict to these elements, but in your case you want to use latex rendering in a Title element, which doesn’t work.

This has already been fixed in the next release candidate for bokeh 3.0, at least for Title and Label elements (done in https://github.com/bokeh/bokeh/pull/11708), but as bokeh 3.0 is still at the release candidate stage, you’ll need to do pip install bokeh --pre to try it out. It is also a major version which probably has some backward incompatible changes, so some of the bokeh code in ArviZ might not work with it. I will be closing the issue as it is nothing to be fixed on our side, but feel free to let us know how it goes if you try this. We’ll test ArviZ with bokeh 3.0 once the api is final and a release is made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support latex labels · Issue #647 · bokeh/bokeh - GitHub
I tried using LaTeX on the axis label, but it does not render. Does anyone know if there is special syntax to enable...
Read more >
Use Latex in Bokeh axis label - Stack Overflow
Bokeh 2.4 adds support for LaTeX (and MathML) to some elements in Bokeh. Currently, you can use LaTeX on axis labels, tick labels,...
Read more >
Releases — HoloViews v1.15.3
This is a major release with a large number of new features and bug fixes, as well as updates to Python and Panel...
Read more >
Mathematical notation — Bokeh 3.0.3rc1 Documentation
To use LaTeX notation, you can pass a string directly to any supported element. This string needs to begin and end with one...
Read more >
Changelog - Streamlit Docs
This page lists highlights, bug fixes, and known issues for official Streamlit releases. If you're looking for information about nightly releases, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found