I have a very basic question : how to do a line break with matplotlib in python with an “annotate” command. I tried “\” and “\n” but it does not work. And how to do this for a “Latex” annotation and for a normal text annotation ?
Thank you very much.
What exactly did you try?
Were you, by chance, using a raw string (e.g.
r"whatever")?'\n'works perfectly, but if you’re using a raw string to avoid latex sequences being interpreted as an escape, it will be interpreted by python as'\'and'n'instead of a newline.As an example:
On the other hand, if we use a raw string: