I am trying to place two tikz axes side by side. I currently encapsulate each in a subfigure, but it seems that there are too much white space around the tikz figures that I can barely see the pictures even if I set the width to 0.5\tetxwidth
. I have the following code, would appreciate any help!
\begin{figure*}
\begin{center}
\begin{subfigure}[t]{0.5\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
width=0.5\textwidth,
axis lines=middle,xmin=-1.2,xmax=1.2,ymin=-1.2,ymax=1.2,
xlabel=$\scriptstyle x$,ylabel=$\scriptstyle y$,
yticklabels=\empty,
xticklabels=\empty,
axis equal]
\begin{scope}
\clip (0, 0) rectangle (1, 1);
\clip (0, 0)--(0.33, 1)--(0, 1)--cycle;
\fill[yellow, opacity=0.6] (0, 0) circle (1);
\end{scope}
\addplot+[name path = gaussian, no marks,
domain=-1.5:1.5,samples=15] {3*x};
\draw[name path = line] (axis cs:0,0) circle [blue, radius=1];
\end{axis}
\end{tikzpicture}
\end{subfigure}\hfill
\begin{subfigure}[t]{.5\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
width=0.5\textwidth,
axis lines=middle,xmin=-1.2,xmax=1.2,ymin=-1.2,ymax=1.2,
xlabel=$\scriptstyle x$,ylabel=$\scriptstyle y$,
yticklabels=\empty,
xticklabels=\empty,
axis equal
]
\begin{scope}
\clip (0, 0) rectangle (1, 1);
\clip (0, 0)--(0.33, 1)--(0, 1)--cycle;
\fill[yellow, opacity=0.6] (0, 0) circle (1);
\end{scope}
\addplot+[name path = gaussian, no marks,
domain=-1.5:1.5,samples=15] {3*x};
\draw[name path = line] (axis cs:0,0) circle [blue, radius=1];
\end{axis}
\end{tikzpicture}
\end{subfigure}
\end{center}
\end{figure*}