I'm trying to properly center a tikzpicture within a subfigure/figure, however it has not been centering properly. When I enclose the tikzpicture in \fbox, the frame box is properly centered and is also sized according to the tikzpicture, but the tikzpicture does not fall within the frame box.
Below is some sample code for both a figure and subfigure with the same problem. In the second, I draw the first line starting from (0,0), which seems to mostly fix the centering (although I don't know why), but not entirely for the vertical centering. None of the similar questions regarding centering I've found here so far behave in this way.
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h]
\centering
\begin{subfigure}[b]{.8\textwidth}
\centering
\fbox{\begin{tikzpicture}
\tikz[scale=1]{%
\draw[dashed,blue,very thick](-3,-.75) -- (-2,0);
\draw[very thick](-3,.75) -- (-2,0);
\draw[very thick, black] (-2,0) arc (180:90:1.5 and 1);
\draw[very thick, black] (-.5,1) arc (90:0:1.5 and 1);
\draw[dashed, very thick, blue] (1,0) arc (0:-90:1.5 and 1);
\draw[very thick, blue] (-.5,-1) arc (-90:-180:1.5 and 1);
\draw[blue,very thick](1,0) -- (2,-.75);
\draw[-,very thick](1,0) -- (2,.75);
}
\end{tikzpicture}}
\caption{}
\end{subfigure}
\end{figure}
\begin{figure}[h]
\centering
\fbox{\begin{tikzpicture}
\tikz[scale=1]{%
\draw[dashed,blue,very thick](0,0) -- (1,.75);
\draw[very thick](0,1.5) -- (1,.75);
\draw[very thick, black] (1,.75) arc (180:90:1.5 and 1);
\draw[very thick, black] (2.5,1.75) arc (90:0:1.5 and 1);
\draw[dashed, very thick, blue] (4,.75) arc (0:-90:1.5 and 1);
\draw[very thick, blue] (2.5,-.25) arc (-90:-180:1.5 and 1);
\draw[blue,very thick](4,.75) -- (5,0);
\draw[-,very thick](4,.75) -- (5,1.5);
}
\end{tikzpicture}}
\end{figure}
\end{document}
TikZ
yourself instead of using\fbox
here?