How to type Math Symbol into labels or title?
See original GitHub issueimport altair as alt
import pandas as pd
import numpy as np
# Create a selection that chooses the nearest point & selects based on x-value
nearest = alt.selection(type='single', nearest=True, on='mouseover',
fields=['Time'], empty='none')
# The basic line
line = alt.Chart().mark_line(interpolate='basis',color='#333').encode(
x=alt.X('Time:T',axis=alt.Axis(title='Date')),
y=alt.Y('PM25:Q',axis=alt.Axis(title='PM2.5 (μg/m3)'))
)
I tried putting the unit to my y-axis label. Coming from matplotlib I first tried y=alt.Y('PM25:Q',axis=alt.Axis(title=r'PM2.5 $(\mu g/m^{3})$'))
. For now I used Jupyter notebook to type μ but still didn’t figure out how to type the power. I searched through the documentation but didn’t find a solution.
Please help me out if there is a way to do it. Thank you!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Insert mathematical symbols - Microsoft Support
Symbol set Subset Definition
Greek Letters Lowercase Lowercase letters from the Greek alphabet
Uppercase Uppercase letters from the Greek alphabet
Letter‑Like Symbols None Symbols that resemble...
Read more >r - Putting mathematical symbols and subscripts mixed with ...
I think the 'labels' argument to annotate takes a character mode You could look up what Unicode value 'sigma' might have in the...
Read more >Mathematical Annotation in R
In this article we demonstrate how to include mathematical symbols ... a formula in the title of the plot, adding symbols to axis...
Read more >Math Notation for R Plot Titles: expression, bquote, & Greek ...
Use bquote · Strings – Require quotes wrapped w/ tilde separator (e.g., "my text" ~ ). · Math Expressions – Unquoted & follow...
Read more >Using Special Formats and Symbols in Titles
To display a backslash (\) in, for example, a title, use \backslash. HTML Tags. You can use the following HTML tags in text...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Only Unicode characters are supported in Vega. Meaning that rendering of LaTeX text and MathJax is not supported in Altair
You can search for the corresponding superscript character at this page: https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts and copy the character of interest in your specification.
Maybe Altair could implement a preprocessing feature that convert defined MathJax to Unicode characters.
The relevant Vega feature request is here: https://github.com/vega/vega/issues/898