# How can you change position of labels in plot

Is it possible to change the location of number labels on the x-axis? On the plot below, created with Show (3 Plots, 6 ListLinePlots), I would like to move the Temperature tick labels (5, 10, etc.) from below the x-axis to above that axis.

I can share my code if necessary, but mainly I would like to know if there is a built-in function to specify label position relative to the axes?

• Would you be interested in a Frame based solution?
– Syed
Commented Mar 29, 2022 at 20:37
• Any solution is welcome, but if it is possible, i would like to keep it as simple as it can be Commented Mar 29, 2022 at 20:48

A plot that looks like the one in the picture posted in OP:

Plot[{1, 3, 5}, {x, 0, 35}, ImageSize -> Medium, Filling -> Axis,
PlotRange -> {All, {0, 6}}, ScalingFunctions -> {None, "Reverse"},
AxesLabel ->  {"T[°C]", z[mm]}]


1. If it's not essential to have axes labels positioned at the ends, simplest approach is using Frame and ChartingScaledTicks[{Identity, Identity}] to create horizontal axis ticks:

Plot[{1, 3, 5}, {x, 0, 35},
Filling -> Axis, PlotRange -> {All, {0, 6}},
ScalingFunctions -> {None, "Reverse"},
FrameLabel -> {{z[mm], None}, {None, T[Row[{Degree , "C"}]]}},
Frame -> {{True, False}, {False, True}},
FrameTicks -> {{Automatic, None},
{Automatic, ChartingScaledTicks[{Identity, Identity}]}}]


Use ChartingScaledTicks[{Identity, Identity}][0, 35, {8, 6}] to get

2. Alternative approach with more detailed control over positioning and styling of ticks and labels is to use AxisObject:

Create a version without the horizontal axis:

plot = Plot[{1, 3, 5}, {x, 0, 35}, ImageSize -> Medium,
Filling -> Axis, Axes -> {False, True}, PlotRange -> {All, {0, 6}},
ScalingFunctions -> {None, "Reverse"}, AxesLabel ->  {None, z[mm]},
Ticks -> {None, Automatic}]


and use AxisObject to construct an axis with desired features:

xaxis = Graphics @ AxisObject[Line[{{0, 0}, {35, 0}}], {0, 35},
AxisLabel -> "  T[°C]",
TickPositions -> {{Range[5, 35, 5]}, {Range[35]}},
AxisStyle -> Black,
TicksStyle -> {Black, Thickness -> Absolute[0.5]},
TickLabelPositioning -> "Tip",
TickLengths -> {.15, .07}]


Combine plot and xaxis using Show:

Show[plot, xaxis]


Remove the option TickLabelPositioning -> "Tip" and add the option TickDirection -> Down in definition of xaxis` above to get