【发布时间】:2018-08-12 20:44:15
【问题描述】:
在 pgfplots 中,绘制函数时,-5:5 中的默认域。我想默认设置为xmin:xmax。有没有办法做到这一点?换句话说,我希望能够写
\addplot {x^2};
而不是
\addplot[domain=xmin:xmax] {x^2};
更具体地说,这是我寻找的 MWE(但不起作用):
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{domain = min:max}
\begin{document}
\centering
\begin{tikzpicture}
\begin{axis}[xmin=-10, xmax=10, xlabel = $x$, ylabel = {$f(x) = x^2$}]
\addplot{x^2};
\end{axis}
\end{tikzpicture}
\end{document}
【问题讨论】: