I want to change the position of x and y axis labels.
I want to draw the following graph.
But I am able to draw the graph like this.
MWE
\documentclass{article}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=-1.5,
xmax=1.5,
ymin=-1.5,
ymax=1.5,
xtick distance=1, %puts number at a unit distance
ytick distance=1, %puts number at a unit distance
xlabel=$x$,
ylabel={$V(x)$},
% domain=-10:10,
% domain=-2:2,
samples=100,
axis lines=middle,
% code for additional points
extra x ticks={2/3},
extra x tick labels={$\dfrac{2}{3}$},
% ytick={0, 1},
% yticklabels={$0$, $1$},
% xtick={0.66666},
% xticklabels={$2/3$},
% enlarge x limits=0.05,
% enlarge y limits=0.1,
% xtick={0, 1, 2, 3},
% xticklabels={$0$, $1$, $2$, $3$},
% ytick={0, 2, 4, -2},
% yticklabels={$0$, $2$, $4$, $-2$},
% ytick={0, 1},
% yticklabels={$0$, $1$},
]
\addplot [thick, smooth] {x^2 - x^3};
% \addplot [draw = blue, thick, smooth, , domain=0.1:4.1] {x + (1/x)};
% \addplot [draw = blue, thick, smooth, , domain=-4.1:-0.1] {x + (1/x)};
%
% restrict y to domain=-3.2:3.2,
\end{axis}
\end{tikzpicture}


axis labels at tipstyle from https://tex.stackexchange.com/a/17457/36296 This works fine with your code https://i.stack.imgur.com/JSqOI.png – samcarter_is_at_topanswers.xyz May 24 '23 at 13:48axis lines=middle, which otherwise will reset them. (and add the correctcompatoption, as the warning is telling you... ) – Rmano May 24 '23 at 13:53xlabel style={at={(current axis.right of origin)}, xshift=1.5ex, anchor=center}, ylabel style={at={(current axis.above origin)}, yshift=1.5ex, anchor=center}}, but I fail to see how this would be any better... – samcarter_is_at_topanswers.xyz May 24 '23 at 15:03