Issue
I have a series of labels for a range of subplots, each of which is a raw string:
labels = [r"\$beta$", r"\$alpha$", r"$\omega$"]
I want my plots to have the Greek letters displayed, but when I do:
fig, axs = plt.subplots(1, 3)
for i, label in enumerate(labels):
axs[i].set_title(label)
The titles show $beta$, $alpha$, and $omega$ instead of the desired output. I could just use Greek letters for my labels directly, but I was wondering if there's a way to achieve this with raw string formatting. I also tried axs[i].set_title(fr"{label}")
and axs[i].set_title(r"%s"%label)
but without luck so far. Any suggestion?
Solution
slash goes before the keyword:
labels = [r"$\beta$", r"$\alpha$", r"$\omega$"]
see here for more info
Answered By - dermen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.