Caption of tikzpicture and modify vertical space

Caption of tikzpicture placed in wrong postion (see image)

My code is:

\documentclass[8pt]{article}
\usepackage{caption}
\usepackage{pgfplots}
\usepackage{translator, tikz, array}
\usepackage{tikzsymbols}
\usepackage{float}
\usepackage{graphicx}
\usetikzlibrary{arrows,shapes.geometric,positioning}
\begin{document}
Example caption of Tikzpicture:
\begin{figure}
\begin{center}
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north west,inner sep=0,xshift=6.0cm,yshift=0cm]
[circle,draw, very thick, color=red, minimum size=5.0cm, fill overzoom image=example-image-a]{};
\end{tikzpicture}
\captionof*{figure}{ABC}
\end{center}
\end{figure}
\end{document}


How can i put caption under tikzpicture and can change vertical space between caption/tikzpicture? Thank in advance

1. See When should we use \begin{center} instead of \centering?
2. the option overlay is used to write "something" over "something else" and do not consider the dimension of "something", it's like "something" has no dimension, you don't have to use it for an ordinary picture
3. fill overzoom image is an option of tcolorbox, you need to load it
4. if you are in a figure environment, you do not need \captionof, use \caption instead.

\documentclass[8pt]{article}
\usepackage{caption}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage[many]{tcolorbox}

\begin{document}
Example caption of Tikzpicture:
\begin{figure}
\centering
\begin{tikzpicture}
\node[circle, draw, very thick, color=red, minimum size=5.0cm, fill overzoom image=example-image-a] {};
\end{tikzpicture}
\caption{ABC}
\end{figure}
\end{document}


Edit: it's not very clear to me what you want to achieve, but if you want to horizontally move the picture and its caption, use a minipage, like here:

\documentclass[8pt]{article}
\usepackage{caption}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage[many]{tcolorbox}

\begin{document}
In Fig.~\ref{fig:left} the image and its caption are on the left.
\begin{figure}[htb]
\begin{minipage}{.42\linewidth}
\centering
\begin{tikzpicture}
\node[circle, draw, very thick, color=red, minimum size=5.0cm, fill overzoom image=example-image-a] {};
\end{tikzpicture}
\caption{ABC\label{fig:left}}
\end{minipage}
\end{figure}

With \verb|\hspace{...}| you can shift them to the right as you like, see Fig.~\ref{fig:hspa}.
\begin{figure}[htb]\hspace{5cm}
\begin{minipage}{.42\linewidth}
\centering
\begin{tikzpicture}
\node[circle, draw, very thick, color=red, minimum size=5.0cm, fill overzoom image=example-image-a] {};
\end{tikzpicture}
\caption{ABC\label{fig:hspa}}
\end{minipage}
\end{figure}

With \verb|\hfill| you can shift them completely to the right, see Fig.~\ref{fig:hfi}.
\begin{figure}[htp]\hfill
\begin{minipage}{.42\linewidth}
\centering
\begin{tikzpicture}
\node[circle, draw, very thick, color=red, minimum size=5.0cm, fill overzoom image=example-image-a] {};
\end{tikzpicture}
\caption{ABC\label{fig:hfi}}
\end{minipage}
\end{figure}
\end{document}


• thank so much. In my code: "anchor=north west,inner sep=0,xshift=6.0cm,yshift=0cm" - How can i put this image & caption in position (x cm, y cm)? Thanks – latexforti Mar 17 '19 at 21:13
• @latexforti with respect to the page? – CarLaTeX Mar 17 '19 at 21:40
• this tikzimage placed center of page. Can you move this image with xshift, yshift? Thanks – latexforti Mar 17 '19 at 23:14
• see more in link. imgur.com/Cm5y8x4 . thanks – latexforti Mar 18 '19 at 1:28
• @latexforti See my edit and let me know if it's what you would like, thank you! – CarLaTeX Mar 18 '19 at 6:49