当我尝试绘制组图时收到错误。我做错了什么?
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 2},width=\textwidth]
\nextgroupplot[xmin = -1, xmax = 1, ymin = -1, ymax = 1,
axis lines=middle,
]
\addplot[black] (1.2,0) node[above left] {$t$};
\addplot[black] (0,.7) node[below right] {$x$};
\addplot[blue,samples=1000,domain=0:15] {x*(1-x)};
\nextgroupplot[xmin = -2, xmax = 2, ymin = -1, ymax = 1,
axis lines=middle]
\addplot[black] (1.2,0) node[above left] {$t$};
\addplot[black] (0,.7) node[below right] {$x$};
\addplot[blue,samples=1000,domain=-10:15] {x*(1-x)-((3)*rad(atan(x)))/(pi)};
\end{groupplot}
\end{tikzpicture}
\caption{Varying values for $a$ in $\dfrac{\mathrm{d}x}{\mathrm{d}t} = rx(1-x) - \frac{a}{\pi}\arctan{x}$ where $a = 0, 3, -1, 4$ (Order of graphs: left to right, up to down)}
\end{figure}
答案1
width=\textwidth
建议改为width=0.5\textwidth, height=0.5\textwidth
,原来的plot整体太大了。新代码如下:
\documentclass{article}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usepgfplotslibrary{groupplots}
\usepackage{float}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 2},width=0.5\textwidth, height=0.5\textwidth]
\nextgroupplot[xmin = -1, xmax = 1, ymin = -1, ymax = 1,
axis lines=middle,
]
\addplot[black] (1.2,0) node[above left] {$t$};
\addplot[black] (0,.7) node[below right] {$x$};
\addplot[blue,samples=1000,domain=0:15] {x*(1-x)};
\nextgroupplot[xmin = -2, xmax = 2, ymin = -1, ymax = 1,
axis lines=middle]
\addplot[black] (1.2,0) node[above left] {$t$};
\addplot[black] (0,.7) node[below right] {$x$};
\addplot[blue,samples=1000,domain=-10:15] {x*(1-x)-((3)*rad(atan(x)))/(pi)};
\end{groupplot}
\end{tikzpicture}
\caption{Varying values for $a$ in $\dfrac{\mathrm{d}x}{\mathrm{d}t} = rx(1-x) - \frac{a}{\pi}\arctan{x}$ where $a = 0, 3, -1, 4$ (Order of graphs: left to right, up to down)}
\end{figure}
\end{document}