Ask Your Question

MartinS's profile - activity

2020-11-20 08:38:48 +0200 received badge  Famous Question (source)
2019-11-16 22:11:58 +0200 received badge  Notable Question (source)
2019-11-15 03:05:45 +0200 received badge  Popular Question (source)
2018-09-23 09:44:46 +0200 received badge  Nice Question (source)
2018-09-20 19:39:32 +0200 received badge  Student (source)
2018-09-20 19:38:51 +0200 asked a question Latex in plot()/text() - include extra latex packages

Hello,

I'm desperately trying to label axes using the siunitx package, for example:

plot(..., axes_labels=['$\si{\volt}$', '\si{\second}'])
text("\SI{1}{\ampere}", (2, 2))

However, I cannot find a way how to load the package. So far I have tried:

from matplotlib import rc
rc('text', usetex=True)
rc('text.latex', preamble='\\usepackage{siunitx}')

and

from sage.misc.latex import latex_extra_preamble
latex.add_to_preamble('\\usepackage{siunitx}')

Neither of these seems to work (\SI is either simply ignored or unknow). Furthermore, I need to use the '\text{}' macro, which seems to be unavailable as well (need to load amsmath?).

Any help most appreciated!