Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Syntax issue with plt.title(r'title')
-
So I have a line of code to set a plot title:
plt.title(r'title')
But what I really want to do is replace 'title' with a variable string. I try but it won't run because of that r character. How is the syntax suppose to be?
Here is what I have tried:
plt.title(r self.tf.text) #bad
and
plt.title(r[self.tf.text]) #bad
any ideas?
-
You don't need the
r
at all, that's just for raw string literals, which are typically used for regular expressions. Just use something likeplt.title(self.tf.text)
.