Legendar tikzpicture e modificar o espaço vertical

Legendar tikzpicture e modificar o espaço vertical

Legenda da imagem tikz colocada na posição errada (ver imagem)

Meu código é:

\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}

insira a descrição da imagem aqui

Como posso colocar legenda em tikzpicture e alterar o espaço vertical entre caption/tikzpicture? Agradeço antecipadamente

Responder1

  1. VerQuando devemos usar \begin{center} em vez de \centering?
  2. a opção overlayé usada para escrever "algo" sobre "outra coisa" e não considera a dimensão de "algo", é como se "algo" não tivesse dimensão, você não precisa usá-lo para uma imagem comum
  3. fill overzoom imageé uma opção de tcolorbox, você precisa carregá-lo
  4. se você estiver em um figureambiente que não precisa \captionof, use \caption.

\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}

insira a descrição da imagem aqui

Editar:não está muito claro para mim o que você deseja alcançar, mas se quiser mover a imagem horizontalmenteesua legenda, use um minipage, como aqui:

\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}

insira a descrição da imagem aqui

insira a descrição da imagem aqui

informação relacionada