title: how to align two tikzpicture plots in latex
body: <p>I am trying to use the subfigure method shown at <a href="https://www.latex-tutorial.com/tutorials/figures/" rel="noreferrer">https://www.latex-tutorial.com/tutorials/figures/</a> to make side by side plots but I can't seem to adjust the size and get them to go side by side...what am i doing wrong?
  Below is code I am using </p>
  
  <pre class="lang-latex prettyprint-override"><code>\begin{figure}
          \centering
          \begin{subfigure}[b!]{0.3\textwidth}
              \begin{tikzpicture}
                  \begin{axis}[
                      axis y line = middle,
                      axis x line = middle,
                      xlabel = $x$,
                      ylabel = {$f(x) = x^3$},
                      grid=major,
                  ]
                  \addplot [
                      domain=-3:3, 
                      samples=100, 
                      color=red,
                  ]
                  {x^3};
                  \addlegendentry{$x^3$}
                  %
                  \addplot [
                      domain=-3:3, 
                      samples=100, 
                      color=blue,
                      ]
                      {x^3 + 3};
                  \addlegendentry{$x^3 + 3$}
                   %
                  \addplot [
                      domain=-3:3, 
                      samples=100, 
                      color=green,
                      ]
                      {x^3 - 3};
                  \addlegendentry{$x^3 - 3$}
                  \end{axis}
              \end{tikzpicture}
          \end{subfigure}
          %\hfill
          \begin{subfigure}[b]{0.3\textwidth}
              \begin{tikzpicture}
                  \begin{axis}[
                      axis y line = middle,
                      axis x line = middle,
                      xlabel = $x$,
                      ylabel = {$f(x) = x^3$},
                      grid=major,
                  ]
                  \addplot [
                      domain=-3:3, 
                      samples=100, 
                      color=red,
                  ]
                  {x^3};
                  \addlegendentry{$x^3$}
                  \end{axis}
              \end{tikzpicture}
          \end{subfigure}
          \caption{lajsdfls}
      \end{figure}
  </code></pre>