# math mode in ticks ( tikzpicture )

I plotted the following function:

Here is the script used:

    \documentclass[a4paper, 11pt]{article}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}[>=latex]
\begin{axis}[
axis x line=bottom,
axis y line=left,
ylabel={M},
xtick={0,1,...,5},
ytick={0,1,...,5},
]
coordinates {(0,0)(1,0)(1,1)(2,1)(2,2)(3,2)(3,3)(4,3)};
\end{axis}
\end{tikzpicture}
\end{document}


I want that instead of having numbers in ticks, to have something that looks like:

How can I get the math mode in the ticks ?

You can use xticklabels and yticklabels for that.

\documentclass[a4paper, 11pt]{article}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}[>=latex]
\begin{axis}[
axis x line=bottom,
axis y line=left,
ylabel={$M$},xmax=4.5,ymax=3.5,
xtick={1,4},xticklabels={$\rho_\mathrm{min}$,$\rho_\mathrm{max}$},
ytick={0,3},yticklabels={$0$,$M_\mathrm{max}$}