Matplotlib Latex Textfarbe

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Matplotlib Latex Textfarbe

by Anonymous » 09 Apr 2025, 23:15

Ich möchte teilweise einen Latex -Text in meinem Plot unter Verwendung des Befehls \ textColor {} < /code> färben.import matplotlib
matplotlib.use('TKAgg')

from matplotlib import rc
rc('text',usetex=True)
rc('text.latex', preamble=r'\usepackage{color}')
import matplotlib.pyplot as plt

if __name__ == "__main__":
fig = plt.figure()
fig.text(0.5, 0.5, r'black \textcolor{red}{red}')
plt.show()
< /code>
Ändern des Backends in PC, wie es hier getan wird>

Top