Forse l’opzione che serve a te è [tt]varwidth[/tt]. Prova questo esempio se corrisponde a quello che cerchi.
`
\documentclass
{standalone}
\usepackage{pgfplots}
\usepackage{kpfonts}
\pgfplotsset{every axis/.append style={
axis x line=bottom,
axis line style={->},
xlabel={$\rho$},
axis lines = left,
xtick = \empty,
ytick = \empty,
every axis x label/.style={at={(axis description cs:1,0)},anchor=west},
every axis y label/.style={at={(axis description cs:0,1)},anchor=east}
},
}
\tikzset{>=stealth}
\begin{document}
\begin{tikzpicture}
\useasboundingbox (-0.5,-0.5) rectangle (7.5,6);
\begin{axis}[
ylabel=$D$,
xmin=0,xmax=5,
ymin=-1,ymax=6,
]
\addplot[domain = 0:1]{5*x};
\addplot[domain=1:4]{5};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\useasboundingbox (-0.5125,-0.5) rectangle (7.5,6);
\begin{axis}[
ylabel = $S$,
xtick = {1, 4},
xticklabels = {$\rho_c$, $\rho_j$},
xmin=0,xmax=5,
ymin=-1,ymax=6,
]
\addplot[domain = 0:1]{5};
\addplot[domain=1:4]{-5/3 * (x-1) + 5};
\end{axis}
\end{tikzpicture}
\end{document}
`