Issue
I have problems in using tex expression into matplotlib and putting them into bold format. I cannot at the moment find a solution.
Here is a minimal example. How can I put the subscripts, superscripts and the greek-letters into bold format ?
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rc
rc('text', usetex=True)
x = np.arange(10)
first_plot, = plt.plot(x[:],2*x[:],'k-')
second_plot, = plt.plot(x[:],4*x[:],'k-')
third_plot, = plt.plot(x[:],6*x[:],'k-')
plt.legend([first_plot,second_plot,third_plot],[r'\textbf{A}$_\sigma$',
r'\textbf{B}',r'\textbf{a$^2$}'], fontsize=36, loc=[0.4,0.70],frameon=False)
plt.show()
Solution
This is rather related to latex than to matplotlib. But for easy cases like this you can use \boldmath
.
[ r'\textbf{A}\boldmath$_\sigma$',
r'\textbf{B}',
r'\textbf{a\boldmath$^2$}']
See e.g. this question on tex.stackexchange.
Answered By - ImportanceOfBeingErnest
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.