How to show the fraction line as a slash instead of horizontal bar in plot tick labels?

You could specify a custom label for each tick, programmatically generated using the InputForm of the fraction, which uses the horizontal dash. For instance:

Plot[
 x, {x, 0, 3},
 Ticks -> {{#, InputForm[#]} & /@ Range[0, 3, 1/3], Automatic}
]

with axes


To address your comment regarding the dropped labels, you may be better off using a Frame and FrameLabels instead:

Plot[
 x, {x, 0, 3},
 Frame -> {{True, False}, {True, False}},
 FrameTicks -> {{#, InputForm[#]} & /@ Range[0, 3, 1/3], Automatic}
]

with frame


If one is allowed to use a package, here is another possibility. First load MaTeX then

SetOptions[MaTeX, "Preamble" -> {"\\usepackage{nicefrac}"}];
makeFrac[n_] := If[Denominator[n] == 1, MaTeX[n, Magnification -> 1.5], 
   MaTeX["\\nicefrac{" <> ToString[Numerator[n]] <> "}{" <> 
     ToString[Denominator[n]] <> "}", Magnification -> 1.5]];

texStyle = {FontFamily -> "Latin Modern Roman", FontSize -> 14};

Plot[x, {x, 0, 3}, 
 Ticks -> {{#, makeFrac[#]} & /@ Range[0, 3, 1/3], Automatic}, 
 BaseStyle -> texStyle]

Mathematica graphics

I would do both axes using Latex myself and not one to make it look better. And I think the fractions look better than using Mathematica's own typesetting ;)


ClearAll[fractionToRow]
fractionToRow = RawBoxes @* 
   ReplaceAll[FractionBox -> (RowBox[{#, "/", #2}] &)] @* ToBoxes @* TraditionalForm

plt1 = Plot[Sin@x, {x, 0, 2 Pi}, ImageSize -> 300, 
   Ticks -> {Range[0, 2 Pi, Pi/2], Automatic}];

plt2 = Plot[Sin@x, {x, 0, 2 Pi}, ImageSize -> 300, 
   Ticks -> {{#, fractionToRow @ #} & /@ Range[0, 2 Pi, Pi/2], Automatic}];

Row[{plt1, plt2}, Spacer[10]]

enter image description here

This approach works for simple inputs (as is usually the case for tick labeling).

Another example:

TraditionalForm[Style[Pi^(I/2)/ (I + E/Pi), 24]]

enter image description here

fractionToRow2 @ Style[Pi^(I/2)/ (I + E/Pi), 24]

enter image description here\

For more complicated inputs more work may be needed for appropriate parsing.