python-visualization / branca

This library is a spinoff from folium, that would host the non-map-specific features.
https://python-visualization.github.io/branca/
MIT License
110 stars 63 forks source link

How to show latex caption? #139

Closed zxdawn closed 9 months ago

zxdawn commented 9 months ago
from branca.colormap import linear

colormap_choice = linear.YlOrRd_04
vmin = 3.2
vmax = 10.3
colormap = colormap_choice.scale(vmin, vmax)
colormap.caption = '$\Delta$ x'
colormap
image

It seems the latex symbol $\Delta$ is neglected.

zxdawn commented 9 months ago

Well, I can use HTML symbol instead of latex: 'Δx':

image
ocefpaf commented 9 months ago

branca doesn't ship any math JS libraries, only basic HTML is supported. One can easily write a plugin for Mathjax, etc though. I'm closing this b/c it is not in the scope of branca.

zxdawn commented 9 months ago

Thanks for your reply. I realize that 'Δx' works for the colormap caption. However, if I add it to folium map, it's not rendered:

from branca.colormap import linear
import folium

colormap_choice = linear.YlOrRd_04
vmin = 3.2
vmax = 10.3
colormap = colormap_choice.scale(vmin, vmax)
colormap.caption = 'Δx'

m = folium.Map()
colormap.add_to(m)
image

Any idea of this?

ocefpaf commented 9 months ago

Most likely a bug in folium. Do you mind opening this issue there?

zxdawn commented 9 months ago

Got it. Posted here.