Graphics, Figures & TablesPut the title below the figures in Tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
Mohsen Avaji
Posts: 16
Joined: Mon Aug 27, 2012 12:06 am

Put the title below the figures in Tikz

Post by Mohsen Avaji »

Hi,
In the submitted code, I want captions of the figures be in the below of the circles and refer to them in the in text but but they are not under the circles, what should I do?

Code: Select all

[latex]\documentclass[11pt,a4paper,twoside]{book} 

\usepackage{amsmath,amssymb}%
\usepackage{caption,graphicx,subfigure}
\usepackage[newparttoc]{titlesec}
\usepackage{mathtools}
 \usepackage{xcolor}
  	\definecolor{deepskyblue}{rgb}{0.0, 0.75, 1.0}
\usepackage{tikz-cd}
\usepackage{tikz}

\counterwithin{figure}{chapter}

\begin{document}
\chapter{Analytic function}
\setcounter{section}{2}
\section{Local behavior}

\begin{figure}[!h]
\centering
\renewcommand{\thesubfigure}{(a)}%\hspace{2cm}
\subfigure[{}]
{
\begin{tikzpicture}[line width=0.9pt]
\begin{scope}[>=latex]
\draw (2,0.8) node{$a(z-z_{0})F(z)$};
\draw[->] (1.2,0.2) to [out=30, in=150] (2.2,0.2) ; 
 \draw[clip] plot[smooth cycle,variable=\t,samples at={0,45,...,315}] (\t:{1*(1+0.1*rnd)});
 \foreach \X [count=\Y starting from 0] in {red,blue,green!70!black}
 {\draw[\X] plot[smooth,variable=\t,samples at={0,0.25,...,1.75}] 
 ({15+6*(rnd)+120*\Y}:\t);
 }
 \end{scope}
\end{tikzpicture}\label{Figure3.2a}
}
\renewcommand{\thesubfigure}{(b)}%\hspace{2cm}
\subfigure[{}]
{
\begin{tikzpicture}
\begin{scope}[>=latex]
\draw (0,0) circle [radius=1cm];
\draw[draw=red,thick] (0,0)--(1,0);
\draw[draw=blue,thick] (0,0)--({cos(120)},{sin(120)});
\draw[draw=green,thick] (0,0)--({cos(240)},{sin(240)});
\fill (0,0) circle (1.3pt);
\draw (1,0) node[right]{$t$};
\draw (2,0.8) node{$z^{n}+f(z_{0})$};
\draw[->,line width=0.9pt] (1.2,0.2) to [out=30, in=150] (2.2,0.2) ;
\end{scope}
\end{tikzpicture}
}
\renewcommand{\thesubfigure}{(c)}
\subfigure[]
{
\begin{tikzpicture}
\draw (2,0) circle [radius=0.7cm];
\draw[draw=red,thick] (2,0)--(2.7,0);%plum
\fill (2,0) circle (1.3pt);
\draw (2.3,0.2) node{$t^{n}$};
\draw[scale=0.5] (4,0) node[below]{$f(z_{0})$};
\end{tikzpicture}\label{Figure3.2c}
}
\caption{Local behavior of an analytic function.}\label{fig3.2}
\end{figure}

Figure \ref{Figure3.2a}
\end{document}[/latex]
Attachments
TikzFig.pdf
(15.58 KiB) Downloaded 258 times
TikzFig.tex
(1.92 KiB) Downloaded 261 times
Yours faithfully,
Mohsen Avaji.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Put the title below the figures in Tikz

Post by Bartman »

I don't know, what you should do, but you could reduce the content in the tikzpicture environments in the first two drawings to the circle and insert the outer drawings only in a separate environment at the end of the figure environment.

Here is my suggestion:

Code: Select all

\documentclass[11pt,a4paper]{book}% twoside is the default setting of the class

\usepackage{amssymb}
\usepackage{caption,subfigure}% subfigure has been outdated for many years
\usepackage[newparttoc]{titlesec}
\usepackage{mathtools}% loads amsmath
\usepackage{tikz-cd}% loads tikz, that loads xcolor and graphicx
\usepackage[noabbrev,capitalise]{cleveref}% added

\definecolor{deepskyblue}{rgb}{0.0, 0.75, 1.0}
\counterwithin{figure}{chapter}

\begin{document}
\chapter{Analytic function}
\setcounter{section}{2}
\section{Local behavior}

\begin{figure}[!h]
  \centering
  \tikzset{remember picture, >=latex}% added
  \subfigure[]
  {
    \begin{tikzpicture}[line width=0.9pt]
    \coordinate (arrow start a) at (1.2,0.2);% added
    \draw[clip] plot[smooth cycle,variable=\t,samples at={0,45,...,315}] 
      (\t:{1*(1+0.1*rnd)})
    ;
    \foreach \X [count=\Y starting from 0] in {red,blue,green!70!black}
    {\draw[\X] plot[smooth,variable=\t,samples at={0,0.25,...,1.75}] 
     ({15+6*(rnd)+120*\Y}:\t);
    }
    \end{tikzpicture}\label{Figure3.2a}
  }
  \hspace{2cm}
  \subfigure[]
  {
    \begin{tikzpicture}
    \draw (0,0) circle [radius=1cm];
    \draw[draw=red,thick] (0,0)--(1,0);
    \draw[draw=blue,thick] (0,0)--({cos(120)},{sin(120)});
    \draw[draw=green,thick] (0,0)--({cos(240)},{sin(240)});
    \fill (0,0) circle (1.3pt);
    \coordinate (right circle border b) at (1,0);% added
    \coordinate (arrow start b) at (1.2,0.2);% added
    \end{tikzpicture}
  }
  \hspace{2cm}
  \subfigure[]
  {
    \begin{tikzpicture}
    \draw (2,0) circle [radius=0.7cm];
    \draw[draw=red,thick] (2,0)--(2.7,0);%plum
    \fill (2,0) circle (1.3pt);
    \draw (2.3,0.2) node{$t^{n}$};
    \draw[scale=0.5] (4,0) node[below]{$f(z_{0})$};
    \end{tikzpicture}\label{Figure3.2c}
  }
  \caption{Local behavior of an analytic function.}\label{fig3.2}
  \begin{tikzpicture}[overlay]% added
  \path [->, line width=0.9pt, out=30, in=150, above, nodes={xshift=5mm}] 
    (arrow start a) edge node {$a(z-z_{0})F(z)$} ([xshift=1cm]arrow start a)
    (arrow start b) edge node {$z^{n}+f(z_{0})$} ([xshift=1cm]arrow start b)
  ;
  \node [right] at (right circle border b) {$t$};
  \end{tikzpicture}
\end{figure}

\cref{Figure3.2a}
\end{document}
User avatar
Mohsen Avaji
Posts: 16
Joined: Mon Aug 27, 2012 12:06 am

Put the title below the figures in Tikz

Post by Mohsen Avaji »

Dear Bartman
Thank you for your valuable suggestion. Your help solved my problem.
Yours faithfully,
Mohsen Avaji.
Post Reply