First time here? Check out the FAQ!

Ask Your Question
0

How to put fractions in legends?

asked 8 years ago

Romuald_314 gravatar image

Hi,

I've, for example, a plot of a function with a legend. I want to put a fraction or some advanced LaTeX code within the legend block, but I can't. How can I do? Thanks.

goo.gl/ic5lQZ

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 8 years ago

mforets gravatar image

updated 8 years ago

  • use double backslash, as in legend_label='function equation: $y(x)= \\frac{1}{x}$', or
  • use a "raw string literal" flag, r, as in legend_label=r'function equation: $y(x)= \frac{1}{x}$'.
Preview: (hide)
link

Comments

Seems to work fine. Thank you, now I'm aware of this tip!

Romuald_314 gravatar imageRomuald_314 ( 8 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 8 years ago

Seen: 412 times

Last updated: Jan 22 '17