Problems with formatting PlotLegends text [closed]

To avoid issues, I post here the photo to explain you better what my problem is.

So what I would like to have, is a "correct" writings of the legend text for the Blue function. I would like it to be written as

$$x^2 - 2$$

not as

$$-2 + x^2$$

Is there a way to do it?

Thank you!

Version: Mathematica 9

closed as off-topic by Bob Hanlon, user9660, MarcoB, Öskå, dr.blochwaveJan 9 '16 at 23:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, Community, MarcoB, Öskå, dr.blochwave
If this question can be reworded to fit the rules in the help center, please edit the question.

• Simply use Strings instead to avoid all issues. – Sascha Jan 7 '16 at 14:40
• By inserting your code into your question as part of an image you have created more issues than you solved. Please enter code as markdown text as instructed in site editor instructions and the site FAQ. – m_goldberg Jan 7 '16 at 14:43
• I don't think to know what Strings is.. Could you explain better? :/ @Sascha – Henry Jan 7 '16 at 14:43
• Use "x^2 - 2" instead of x^2 -2 – Sascha Jan 7 '16 at 14:44
• You obviously have to type in your expression as you did before. I just didn't know how to format inside a comment. In the example you posted just wrap the equation part you want to print inside " " – Sascha Jan 7 '16 at 14:50

You can solve your problem by indicating you want "TraditionalForm" applied to your legend text. Here is a simplified example you can adapt to your needs.

Plot[x^2 - 2, {x, -5, 5},
PlotStyle -> Red,
PlotLegends ->
SwatchLegend[{Red}, {Style[x^2 - 2, "TraditionalForm", Bold, Red]}]]


Update

In V9, you can use

Plot[x^2 - 2, {x, -5, 5},
PlotStyle -> Red,
PlotLegends ->
SwatchLegend[{Red}, {Style[TraditionalForm[x^2 - 2], Bold, Red]}]]

• This is perfect. Thank you again M_Goldberg!! – Henry Jan 7 '16 at 14:56
• Oh Wait... I just tried it and.. nothing! What appears in my legend is still $$-2 + x^2$$ :( – Henry Jan 7 '16 at 14:58
• I think you have Mathematica 10. I have 9 instead.. – Henry Jan 7 '16 at 14:59
• @KimPeekII Yes, I am using V10.3 Your question didn't mention you wanted a solution for V9. – m_goldberg Jan 7 '16 at 15:01
• I?m sorry, sometimes I forget I have the Version 9 xD I'm used to it and I forget the other people may have the 10 one! >.< – Henry Jan 7 '16 at 15:02

Just for a different approach:

Plot[x^2 - 2, {x, -5, 5}, PlotStyle -> Red,
PlotLegends -> SwatchLegend[{Red},
{PolynomialForm[x^2 - 2, TraditionalOrder -> True]}]]