\documentclass{extarticle}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=center,
axis y line=center,
xtick=\empty,
ytick=\empty,
xlabel={$x$},
ylabel={$y$},
xlabel style={below right},
ylabel style={above left},
xmin=-5.5,
xmax=5.5,
ymin=-5.5,
ymax=5.5]
\addplot [mark=none,domain=-4:4] {x^2-3x} node {$y=x^2-3x$};
\end{axis}
\end{tikzpicture}
\end{document}
错误消息是:包 PGF 数学错误:未知运算符x' or
x@'(在'x^2-3x'中)。
答案1
简单。看一下我的建议:
\documentclass{extarticle}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=center,
axis y line=center,
xtick=\empty,
ytick=\empty,
xlabel={$x$},
ylabel={$y$},
xlabel style={below right},
ylabel style={above left},
xmin=-5.5,
xmax=5.5,
ymin=-5.5,
ymax=5.5]
\addplot [domain=-4:5] {x^2 - 3*x};
\end{axis}
\end{tikzpicture}
\end{document}