Im working with matplotlib and I want an arrow beside my "axis-legend". But I have no idea how. In the example, the arrows I want are drawn in red. thanks
You can generate arrows as shown in your example figure by using the TeX renderer built into matplotlib. Coloring is an option for the whole strings, although generating multiple colors in a single text string is more work.
This will give you the mathematical symbols plus the arrows (I've shown different lengths on each axis label):
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
# plot your data here ...
ax.set_xlabel(r'$\rho/\rho_{ref}\;\rightarrow$', color='red')
ax.set_ylabel(r'$\Delta \Theta / \omega \longrightarrow$')
plt.show()
plt.close()
Resulting in:
Partial coloring of text in matplotlib deals with multi-color strings, and this solution describes how to use the latex engine with multiple colors. However, it does not color what is rendered in the interactive graph, so it depends on your exact needs.
More arrows in LaTeX math mode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With