Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Superscripts can be included in axis labels by the use of the caret symbol (e.g., Plot[x^2, {x, -1, 1}, AxesLabel -> {x, x^2}]).

How does one include subscripts in an axis label? The use of the underscore character does not seem to work (e.g., Plot[f, {x, -1, 1}, AxesLabel -> {x, f_i(x)}]).

share|improve this question
up vote 12 down vote accepted

There is a subtle problem if you use strings as axis labels. Look closely at a plot like this:

Plot[f, {x, -1, 1}, AxesLabel -> {x, "\!\(\*SubscriptBox[\(f\), \(i\)]\)(x)"}]

You will see that the argument x in the function appears in a different font style than the argument on the horizontal axis.

To make sure that you get a consistent font style on both axes using the default styling for graphics, you should use the following:

Plot[f, {x, -1, 1}, AxesLabel -> {x, HoldForm[Subscript[f, i][x]]}]

Of course, to enter the Subscript expression in your label, you can still use the keyboard shortcuts that are mentioned by @Szabolcs.

The argument in HoldForm is your vertical label, typed in actual Mathematica syntax with square brackets for the function argument. I didn't surround the horizontal label in HoldForm, but you could do that for safety, in particular if your variable x has been assigned a value somewhere else in the Notebook.

share|improve this answer
Thanks, that ensures consistent typesetting of the axis labels. In my case, variables in the axis labels remain italicized. – user001 Mar 15 '12 at 18:59
Yes, it's TraditionalForm. – Jens Mar 15 '12 at 19:01

Enclose the label in quotation marks for safety (just in case any symbols you use in them are defined), and enter two-dimensional input. Check the documentation on how to do it. You can enter a subscript using Ctrl-_ or Ctrl--. The Basic Math Assistant palette can be useful as well---it has a Typesetting section.

share|improve this answer
oooh, how do you do the nice CTRL commands? – tkott Mar 15 '12 at 18:44
@tkott Click the edit link to see ;-) It was really useful here because CTRL-- isn't very clear... Maybe CTRL-[-] – Szabolcs Mar 15 '12 at 18:44
smacks head thanks :) – tkott Mar 15 '12 at 18:45
Despite the fact than I ran out of votes hours ago I keep trying to vote. It's become a habit. – Mr.Wizard Mar 15 '12 at 18:46
Thanks. When I enclose the label in quotation marks, it romanizes the text. Can I force it to remain italic? If I try LabelStyle->{Italic}, the tick labels are italicized in addition to the axis labels. I prefer for the axis labels to be italic and the tick labels to be roman. – user001 Mar 15 '12 at 18:55

That's because _ is only a subscript in LaTeX world. In MMA, you can simply use CTRL+-. The following should show you what I mean (once you copy it into MMA):

Plot[Sin[x], {x, -1, 1}, 
 AxesLabel -> {x, "\!\(\*SubscriptBox[\(f\), \(i\)]\)[x]"}]

Note that the reason that x^2 shows up like it does is because ^2 is automatically changed to MMA's boxes / display format. If you were to write:

Plot[Sin[x], {x, -1, 1}, AxesLabel -> {x, "x^2"}]

You'll notice the caret stick around.

share|improve this answer
Thanks, I erroneously tend to assume I can transplant LaTeX practices to Mathematica. – user001 Mar 15 '12 at 18:53

Another option is to create the label with strings:

Plot[f, {x, -1, 1},
 AxesLabel -> {x, 
   Style[Row[{Subscript["f", "i"], "(x)"}], FontFamily -> "Times", 12,
share|improve this answer
This works fine in most simply labels, but it quickly gets ugly when you have actual Mathematica expressions as labels. Just replace the vertical label by Sin[x] and ask how you'd format that in a string so that it doesn't come out as sin(x) but sin(x). This is just a simple example - the point is that it's much better to let the default TraditionalForm in plot labels do the work for you. – Jens Mar 15 '12 at 21:02
I agree @Jens but the question related to a simple subscript. – Mike Honeychurch Mar 15 '12 at 21:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.