I drawn multiple circle in latex using the following code

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}

\begin{document}

\begin{tikzpicture}
\draw (0,0) circle (1cm) [radius=0.1] node {$T_1$}
circle (0.6cm) 
circle (0.2cm);
\end{tikzpicture}

\end{document}

But, I want add text as shown in the following image ascircle-text

Please guide me as how to add text as per in the image.. Thanks in advance..

up vote 3 down vote accepted

UPDATE: You are already loading the positioning library. In order to be sure that the texts fit, you may want to draw the circles consecutively. This answer comes with a style

concentric fit={with center <center node> and nodes {<list of nodes>}}

this allows you to conveniently fit all texts in a circle node whose center coincides with the one of the center node. If you also load backgrounds, you can shade the circle without wiping out the texts.

\documentclass[border=3.14mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,shadings,backgrounds,calc}
\pgfkeys{tikz/.cd,
maximal concentric radius/.store in=\MaxConcRad,
maximal concentric radius=0,
get maximal distance/.code n args={3}{\foreach \X in {south west,south east,north west,north east}
{\path let \p1=($(#2.center)-(#3.\X)$),\n1={veclen(\x1,\y1)} in 
\pgfextra{\pgfmathsetmacro{#1}{max(#1,abs(\n1))}
\xdef#1{#1}}; }},
center node/.store in=\CenterNode,
get maximal distance from center/.code={\foreach \X in {south west,south east,north west,north east}
{\path let \p1=($(\CenterNode.center)-(#1.\X)$),\n1={veclen(\x1,\y1)} in 
\pgfextra{\pgfmathsetmacro{\MaxConcRad}{max(\MaxConcRad,abs(\n1))}
\xdef\MaxConcRad{\MaxConcRad}}; }
},
concentric fit/.style args={with center #1 and nodes #2}{%
center node=#1,get maximal distance from center/.list=#2,
minimum size=2*\MaxConcRad*1pt,
at={(#1.center)}
}
}

\begin{document}

\begin{tikzpicture}[font=\sffamily]
\node[circle,draw,inner sep=1pt] (T1) at (1,1) {fff};
\node[above=1pt of T1] (eee) {eee};
\node[circle,draw,concentric fit={with center T1 and nodes {eee}}] (bigger circle){};
\node[above=1pt of bigger circle] (aaa) {aaa};
\node[below=1pt of bigger circle] (ccc) {ccc};
\node[left=1pt of bigger circle] (bbb) {bbb};
\node[right=1pt of bigger circle] (ddd) {ddd};
\node[circle,draw,concentric fit={with center T1 and nodes {{aaa,bbb,ccc,ddd}}},
path picture={\begin{scope}[on background layer]
\shade[upper left=blue!20, lower right=blue!40] 
(0,0) circle (\MaxConcRad*1pt);
\end{scope}}] (big circle){};
\end{tikzpicture}
\end{document}

enter image description here

ORIGINAL ANSWER:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,shadings,backgrounds,fit,calc}

\begin{document}

\begin{tikzpicture}[font=\sffamily,inner sep=1pt]
\node[circle,draw,inner sep=1pt] (T1) {$T_1$};
\node[above=1pt of T1] (eee) {eee};
\node[below=1pt of T1,opacity=0] (eee-cheat) {eee};
\node[circle,draw,fit=(eee) (eee-cheat)] (bigger circle) {};
\node[above=1pt of bigger circle] (aaa) {aaa};
\node[below=1pt of bigger circle] (ccc) {ccc};
\node[left=1pt of bigger circle] (bbb) {bbb};
\node[right=1pt of bigger circle] (ddd) {ddd};
\node[circle,draw,fit=(aaa) (bbb) (ccc) (ddd)] (big circle) {};
\begin{scope}[on background layer]
\shade[upper left=blue!20, lower right=blue!40]
let \p1=($(big circle.north)-(big circle.center)$) in
(big circle.center) circle (\y1);
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    This is slighlty different in that you are adding circles around the text as opposed to adding the text within the given circles. Still a valid soluton though. – Peter Grill Aug 10 at 2:49
  • @PeterGrill Yes, that's why it's good there are two answers, but I had already upvoted yours. ;-) (I'll now try to do some concentric fit style,,,,) – marmot Aug 10 at 3:23

You can place nodes with approriate shifts and anchors:

enter image description here

Notes:

  • The bbb and ddd text doesn't quite fit (without scaling, thus the font=\tiny). I modiited the inner sep=0pt of these two so that the separation between the text and its bounding box is set to 0pt.
  • The xshift and yshift are form the center of the circle and the anchor controls which point on the virtual box around the text is positioned at the specified location.

Code:

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}

\begin{document}

\begin{tikzpicture}[font=\tiny]
\draw (0,0) [fill=cyan!30]
    circle  (1cm)   
        node {fff}
        node [yshift=1cm, anchor=north] {aaa}
        node [xshift=1cm, anchor=east, inner sep=0pt] {bbb}
        node [xshift=-1cm, anchor=west, inner sep=0pt] {ddd}
        node [yshift=-1cm, anchor=south] {ccc}
    circle (0.6cm) 
        node [yshift=0.6cm, anchor=north] {eee} 
    circle (0.2cm)
    ;
\end{tikzpicture}%
\end{document}
  • Thank you very much to all[J Leon V., marmot, Peter Grill ] .. exactly this one I expect.. Thanks.. – user1999109 Aug 10 at 4:12
  • Also guide me as; how to add the caption (Fig. Name ) of tikz picture at top/bottom of the image? – user1999109 Aug 10 at 5:06
  • @user1999109: As that is totally unrelated to positioning text, that should be a separate question. There should already be answer on this site regarding captioning. – Peter Grill Aug 10 at 17:28

An option with basic tikz code.

RESULT: enter image description here

MWE:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage[scaled]{helvet}
%\renewcommand*\familydefault{\sfdefault} % Set font to serif family | affect entire document.
\begin{document}
    \begin{tikzpicture}[
        %Environment config
        font=\sffamily, %Best way to write in serif, only afects environment. | credit to @marmot's answer.
        %Environment styles
        Circle/.style={
            circle,
            draw,
            minimum width=#1,
            left color=blue!5,
            right color=blue!80!cyan!25,
            shading angle=45
        }
    ]

    \node[Circle=3.8cm](C) at (0,0){};
    \node[
        Circle=2.3cm,
        label=0:bbb,
        label=90:aaa,
        label=180:ddd,
        label=270:ccc
    ](C) at (0,0){};
    \node[
        Circle,%Radious controled by node text width
        label=-30:fff,
        label=90:eee,
        label=-120:ggg,
    ](C) at (0,0){$\mathsf{T_1}$}; %node text in math serif
    \end{tikzpicture}
\end{document}
  • ok.. Thank you very much to all.. I will check already asked question regarding captioning.. thanks.. – user1999109 Aug 10 at 22:58

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.