0

I'm receiving an error when I'm trying to draw a group plot. What am I doing wrong?

\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}
2
  • You shoud either change your domain range or your x and y range. What region do you want to plot (x:0--15 or -1--1)?
    – Excelsior
    Apr 24, 2021 at 10:02
  • You can try restrict x to domain or restrict y to domain to adjust the range
    – Excelsior
    Apr 24, 2021 at 10:03

1 Answer 1

1

width=\textwidthsuggests changing to width=0.5\textwidth, height=0.5\textwidth, The original plot is too big overall. new code as follow:

\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}   
2
  • If you leave height alone, pgfplots will try to maintain a specific aspect ratio (3:4 ?). Apr 24, 2021 at 14:22
  • @JohnKormylo 240:207 to be precise. (\axisdefaultwidth:\axisdefaultheight) Apr 25, 2021 at 9:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .