5

I use the following code to draw repetitive lines and place nodes in specific locations for later on drawing circles and connecting them with lines.

Is there a simpler way to do this job, as using \foreach command or any other possible simpler method.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[t]
\frametitle{}
\hspace {-1cm}
\begin{tikzpicture}[scale=.7, transform shape,linecolor/.style={ultra thick, green!40!black},dotline/.style={thin, black, loosely dotted}]
\pgfmathsetmacro{\incrmnt}{.6}

\draw [thick,-latex](-.3,0) -- (0,0) -- (5,0);
\draw [thick,-latex](0,-.3) -- (0,0) -- (0,8);
\draw [thick,-latex](6.,0) -- (7,0) -- (14.4,0);
\draw [thick,-latex](8,-.2) -- (8,0) -- (8,8);
\draw [linecolor] (0,\incrmnt*1) node (yal){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {1/12}([shift={(0:8)}]yal.center) node (ya){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {1/12};
\draw [dotline] (0,\incrmnt*1) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*2) node (ybl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {2/12}([shift={(0:8)}]ybl.center) node (yb){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {2/12};
\draw [dotline] (0,\incrmnt*2) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*3) node (ycl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {3/12}([shift={(0:8)}]ycl.center) node (yc){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {3/12};
\draw [dotline] (0,\incrmnt*3) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*4) node (ydl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {4/12}([shift={(0:8)}]ydl.center) node (yd){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {4/12};
\draw [dotline] (0,\incrmnt*4) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*5) node (yel){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {5/12}([shift={(0:8)}]yel.center) node (ye){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {5/12};
\draw [dotline] (0,\incrmnt*5) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*6) node (yfl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {6/12}([shift={(0:8)}]yfl.center) node (yf){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {6/12};
\draw [dotline] (0,\incrmnt*6) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*7) node (ygl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {7/12}([shift={(0:8)}]ygl.center) node (yg){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {7/12};
\draw [dotline] (0,\incrmnt*7) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*8) node (yhl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {8/12}([shift={(0:8)}]yhl.center) node (yh){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {8/12};
\draw [dotline] (0,\incrmnt*8) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*9) node (yhl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {9/12}([shift={(0:8)}]yhl.center) node (yh){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {9/12};
\draw [dotline] (0,\incrmnt*9) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*10) node (yhl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {10/12}([shift={(0:8)}]yhl.center) node (yh){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {10/12};
\draw [dotline] (0,\incrmnt*10) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*11) node (yhl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {11/12}([shift={(0:8)}]yhl.center) node (yh){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {11/12};
\draw [dotline] (0,\incrmnt*11) -- +(0:14cm);

\draw [linecolor] (0,\incrmnt*12) node (yhl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {12/12}([shift={(0:8)}]yhl.center) node (yh){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {12/12};
\draw [dotline] (0,\incrmnt*12) -- +(0:14cm);

\draw [linecolor] (\incrmnt*1,0) node (al){} +(90:\incrmnt*1) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {1} ([shift={(0:8)}]al.center) node (a){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {1} ([shift={(90:\incrmnt*1)}]a.center) node (au){} ([shift={(90:\incrmnt*1)}]au.center) node (auu){};

\draw [linecolor] (\incrmnt*2,0) node (bl){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {2} ([shift={(0:8)}]bl.center) node (b){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {2} ([shift={(90:\incrmnt*1)}]b.center) node (bu){} ([shift={(90:\incrmnt*2)}]bu.center) node (buu){};

\draw [linecolor] (\incrmnt*3,0) node (cl){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {3} ([shift={(0:8)}]cl.center) node (c){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {3} ([shift={(90:\incrmnt*3)}]c.center) node (cu){} ([shift={(90:\incrmnt*2)}]cu.center) node (cuu){};

\draw [linecolor] (\incrmnt*4,0) node (dl){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {4} ([shift={(0:8)}]dl.center) node (d){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {4} ([shift={(90:\incrmnt*5)}]d.center) node (du){} ([shift={(90:\incrmnt*2)}]du.center) node (duu){};

\draw [linecolor] (\incrmnt*5,0) node (el){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {5} ([shift={(0:8)}]el.center) node (e){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {5} ([shift={(90:\incrmnt*7)}]e.center) node (eu){} ([shift={(90:\incrmnt*2)}]eu.center) node (euu){};

\draw [linecolor] (\incrmnt*6,0) node (fl){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {6} ([shift={(0:8)}]fl.center) node (f){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {6} ([shift={(90:\incrmnt*9)}]f.center) node (fu){} ([shift={(90:\incrmnt*2)}]fu.center) node (fuu){};

\draw [linecolor] (\incrmnt*7,0) node (gl){} +(90:\incrmnt*1) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {7} ([shift={(0:8)}]gl.center) node (g){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {7}([shift={(90:\incrmnt*11)}]g.center) node (gu){} ([shift={(90:\incrmnt*1)}]gu.center) node (guu){};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

This is the rest of the code to produce the following drawing

    \draw [ultra thick, blue] (au.center) -- (bu.center) (buu.center) -- (cu.center) (cuu.center) -- (du.center) (duu.center) -- (eu.center) (euu.center) -- (fu.center) (fuu.center) -- (gu.center) (guu.center) --+(0:\incrmnt*2) node (inf){};
\draw [thick, black] (inf.center) +(90:\incrmnt*1) --(inf.center|-0,0) node [xshift=0cm, yshift=-.35cm] {$\infty$};


\draw [thick, red, fill=red] (au.center) circle (.1) (buu.center) circle (.1) (cuu.center) circle (.1) (duu.center) circle (.1) (euu.center) circle (.1) (fuu.center) circle (.1) (guu.center) circle (.1);

\draw [thick, red, fill=white] (a.center) circle (.14) (bu.center) circle (.14) (cu.center) circle (.14) (du.center) circle (.14) (eu.center) circle (.14) (fu.center) circle (.14) (gu.center) circle (.14);

enter image description here

8

In this answer I focus on reproducing your output with \foreach loops. I do not reproduce your named nodes, which are not used anywhere in your code. One can, of course, produce automatically named nodes, which I can add if they happen to be used.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{}
\hspace {-1cm}
\begin{tikzpicture}[scale=.7, transform shape,
linecolor/.style={ultra thick, green!40!black},
dotline/.style={thin, black, loosely dotted}]
\pgfmathsetmacro{\incrmnt}{.6}

\draw [thick,-latex](-.3,0) -- (5,0);
\draw [thick,-latex](0,-.3)  -- (0,8);
\draw [thick,-latex](6.,0)  -- (14.4,0) coordinate (br);
\draw [thick,-latex](8,-.2) -- (8,8) coordinate(tr);
\foreach \X in {1,...,12}
{
\draw [dotline] (0,\X*7cm/12) -- ++ (14,0);
\draw [linecolor] (-\incrmnt/2,\X*7cm/12)node[left]{\X/12} -- ++ (\incrmnt,0)
(8-\incrmnt/2,\X*7cm/12)node[left]{\X/12}-- ++ (\incrmnt,0);
}
\foreach \X in {1,...,7}
{
\draw[linecolor]  (3*\X/5,-\incrmnt/2) node[below]{\X} -- ++ (0,\incrmnt)
(8+3*\X/5,-\incrmnt/2) node[below]{\X} -- ++ (0,\incrmnt);
\pgfmathtruncatemacro{\tst}{abs(\X-4)}
\ifnum\tst=3
\draw[linecolor]  (3*\X/5,0)  -- ++ (0,7/12)
node[fill,red,circle,inner sep=2pt]{};
\else
\draw[linecolor]  (3*\X/5,0)  -- ++ (0,14/12)
node[fill,red,circle,inner sep=2pt]{};
\fi
\ifnum\X=7
\draw[blue,thick]   (8+3*\X/5,{7*(2*\X-2)/12})
node[fill,red,circle,inner sep=2pt]{} -- ++ (2*7cm/12,0) coordinate(xr);
\else
\draw[blue,thick]  (8+3*\X/5,{7*(2*\X-1)/12}) node[fill,red,circle,inner sep=2pt]{}
-- ++ (1*7cm/12,0) node[circle,fill=white,draw=red,inner sep=2pt]{};
\fi
}
\draw (tr-|xr) -- (br-|xr) node[below](ir){$\infty$};
\node at (6.5,0 |-ir) {$-\infty$};
\node[circle,fill=white,draw=red,inner sep=2pt,thick] at (8+3/5,0){};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

  • Thank you very much. But I need the named nodes, because I use them to complete my drawing by placing lines and circles on the right drawing; which I did not mention to simplify the \foreach command. – Hany Oct 28 '18 at 6:24
  • @hany Do you need nodes or coordinates? What are the naming conventions? You can name them automatically, even if your naming convention is a,...,f using \alph{X}, but I'd need to know what the conventions are. – marmot Oct 28 '18 at 6:29
  • Please refer to my edited question for the rest of my code. Thank you. – Hany Oct 28 '18 at 6:32
  • 1
    @AndréC Thank you very much. I appreciate very much your efforts and time. – Hany Oct 28 '18 at 12:52
  • 1
    @gigabytes I asked myself the same question as you and I found the explanation of this syntax in the tikz manual version 3.01a on page 38, I quote This is, indeed, possible using a special syntax: Karl can write (30:1cm |- 0,0). In general, the meaning of (p |- q) is “the intersection of a vertical line through p and a horizontal line through q" – AndréC Nov 5 '18 at 20:09
7

Edit:

Easy-to-read code:

The fundamental principle of programming is to write easy-to-read code, especially with a compiled language like TeX. Indeed, the easier the code is to read and understand, the easier it will be to modify in 6 months, 1 year or 10 years...

So, I write (even if the code is not optimized) the code per feature block. Here:

  • I first draw the axes of the left graph
  • then I draw the graph itself (I put the data in it)
  • I do the same with the second graph.

The code thus structured and commented is easy to understand.

Reuse the code:

The very principle of programming is to reuse the code. To do this we can use macros or more simply foreach loops.

Here you have two graphs with the same axes. All you have to do is build it and reuse it in a scope environment that is moved a few centimetres to the right. This avoids unnecessary calculations.

Once this has been done, the content of the second graph is plotted.

This second graph lends itself well to a foreach loop because each time you move 1 unit to the rigth, you move up 2 units upwards, hence the formula \incrmnt*(2*\x-1) which makes this calculation simple.

The rest is plotted separately since it is not factorizable.

Translated with www.DeepL.com/Translator

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[t]
\frametitle{}
\hspace {-1cm}
\begin{tikzpicture}[scale=.7, transform shape,linecolor/.style={ultra thick, green!40!black},dotline/.style={thin, black, loosely dotted},
point/.style={circle, draw, red, fill=red, scale=0.4},
cercle/.style={circle,draw,scale=.5, red,thick, fill=white,inner sep=6pt}
]
\pgfmathsetmacro{\incrmnt}{.6}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% plot of the abscissa axis (horizontal) and ordinate axis (on the left)
\draw [thick,-latex](-.3,0) -- (5,0);
\draw [thick,-latex](0,-.3) -- (0,8);

\foreach \y in {1,...,12}{
\draw [linecolor] (0,\incrmnt*\y) +(0:.15) -- +(180:.15) node [left] {\y/12};% indexation of ordinate axis (vertical)
\draw [dotline] (0,\incrmnt*\y) -- +(0:8*\incrmnt);% horizontal dotted lines
}
\foreach \x in {1,...,7}{
\draw [linecolor] (\incrmnt*\x,.15) -- (\incrmnt*\x,-.15) node [below] {\x} ;
    }

% draw of the left graph
\begin{scope}[every node/.style={circle, draw, solid, red, fill=red, scale=0.4}]
\draw [linecolor] (\incrmnt*1,\incrmnt*1) node{} -- (\incrmnt,.15);
\draw [linecolor] (\incrmnt*2,\incrmnt*2) node{}-- (\incrmnt*2,.15);
\draw [linecolor] (\incrmnt*3,\incrmnt*2) node{} -- (\incrmnt*3,.15);
\draw [linecolor] (\incrmnt*4,\incrmnt*2) node{} -- (\incrmnt*4,.15);
\draw [linecolor] (\incrmnt*5,\incrmnt*2) node{} -- (\incrmnt*5,.15);
\draw [linecolor] (\incrmnt*6,\incrmnt*2) node{} -- (\incrmnt*6,.15);
 \draw [linecolor] (\incrmnt*7,\incrmnt*1) node {} -- (\incrmnt*7,.15);
\end{scope}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
% graph on the rigth
% plot the same axis by a simple 8cm translation 
\begin{scope}[xshift=8cm]
\draw [thick,-latex](-2,0)node [below right] {$-\infty$}   -- (6,0);
\draw [thick,-latex](0,-.3)  -- (0,8);
\foreach \y in {1,...,12}{
    \draw [linecolor] (0,\incrmnt*\y) +(0:.15cm) -- +(180:.15cm) node [left] {\y/12};% indexation of ordinate axis (vertical)
    \draw [dotline] (0,\incrmnt*\y) -- +(0:10*\incrmnt);% horizontal dotted lines
}
\foreach \x in {1,...,7}{
    \draw [linecolor] (\incrmnt*\x,.15) -- (\incrmnt*\x,-.15) node [below] {\x} ;
    }

% draw the graph on the rigth
\draw [thick, black] (\incrmnt*9,0) node [below] {$\infty$} --+(0,\incrmnt*13);
\foreach \x in {1,...,6}{
\draw[ultra thick, blue](\incrmnt*\x,{\incrmnt*(2*\x-1)})node[point]{}--+(\incrmnt,0)node[cercle]{};
}
\node[cercle] at(\incrmnt,0){};
\draw[ultra thick, blue](\incrmnt*7,\incrmnt*12)node[point]{}--+(\incrmnt*2,0);
\end{scope}

\end{tikzpicture}
\end{frame}
\end{document}

graph-bis

Older answer:

To use a \foreach loop, it is enough to identify the numbers that are modified in parallel in each line. In your code, the first lines can easily be factorized by a loop.

The following ones are more difficult to factor because there is no regularity that can be easily used.

Edit: correction of an omission of factorization

    \documentclass{beamer}
    \beamertemplatenavigationsymbolsempty
    \usepackage{tikz}
    \usepackage{pgfplots}
    \begin{document}
    \begin{frame}[t]
    \frametitle{}
    \hspace {-1cm}
    \begin{tikzpicture}[scale=.7, transform shape,linecolor/.style={ultra thick, green!40!black},dotline/.style={thin, black, loosely dotted}]
    \pgfmathsetmacro{\incrmnt}{.6}

    \draw [thick,-latex](-.3,0) -- (0,0) -- (5,0);
    \draw [thick,-latex](0,-.3) -- (0,0) -- (0,8);
    \draw [thick,-latex](6.,0) -- (7,0) -- (14.4,0);
    \draw [thick,-latex](8,-.2) -- (8,0) -- (8,8);

% Factoring the first 12 operations `\draw`:
    \foreach \y in {1,...,12}{
    \draw [linecolor] (0,\incrmnt*\y) node (yhl){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {\y/12}([shift={(0:8)}]yhl.center) node (yh){} +(180:.15cm) -- +(0:.15cm) node [xshift=-.8cm, yshift=0cm] {\y/12};
    \draw [dotline] (0,\incrmnt*\y) -- +(0:14cm);
    }

    \draw [linecolor] (\incrmnt*1,0) node (al){} +(90:\incrmnt*1) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {1} ([shift={(0:8)}]al.center) node (a){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {1} ([shift={(90:\incrmnt*1)}]a.center) node (au){} ([shift={(90:\incrmnt*1)}]au.center) node (auu){};

    \draw [linecolor] (\incrmnt*2,0) node (bl){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {2} ([shift={(0:8)}]bl.center) node (b){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {2} ([shift={(90:\incrmnt*1)}]b.center) node (bu){} ([shift={(90:\incrmnt*2)}]bu.center) node (buu){};

    \draw [linecolor] (\incrmnt*3,0) node (cl){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {3} ([shift={(0:8)}]cl.center) node (c){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {3} ([shift={(90:\incrmnt*3)}]c.center) node (cu){} ([shift={(90:\incrmnt*2)}]cu.center) node (cuu){};

    \draw [linecolor] (\incrmnt*4,0) node (dl){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {4} ([shift={(0:8)}]dl.center) node (d){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {4} ([shift={(90:\incrmnt*5)}]d.center) node (du){} ([shift={(90:\incrmnt*2)}]du.center) node (duu){};

    \draw [linecolor] (\incrmnt*5,0) node (el){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {5} ([shift={(0:8)}]el.center) node (e){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {5} ([shift={(90:\incrmnt*7)}]e.center) node (eu){} ([shift={(90:\incrmnt*2)}]eu.center) node (euu){};

    \draw [linecolor] (\incrmnt*6,0) node (fl){} +(90:\incrmnt*2) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {6} ([shift={(0:8)}]fl.center) node (f){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {6} ([shift={(90:\incrmnt*9)}]f.center) node (fu){} ([shift={(90:\incrmnt*2)}]fu.center) node (fuu){};

    \draw [linecolor] (\incrmnt*7,0) node (gl){} +(90:\incrmnt*1) node [circle, draw, solid, red, fill=red, scale=0.4]{} -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {7} ([shift={(0:8)}]gl.center) node (g){} +(90:.25cm) -- +(-90:.25cm) node [xshift=0cm, yshift=-.35cm] {7}([shift={(90:\incrmnt*11)}]g.center) node (gu){} ([shift={(90:\incrmnt*1)}]gu.center) node (guu){};

    \end{tikzpicture}
    \end{frame}
    \end{document}

graphs

  • Thank you very much. If you ignore the different lengths and circles of the left drawing and make them equal (without circles) as in the right drawing; then draw the different length lines later on; could this simplify using \foreach command to automate the repetition? – Hany Oct 28 '18 at 6:14
  • 1
    @Hany Yes, of course, and marmot just did the work! – AndréC Oct 28 '18 at 6:30
  • Thank you very much for your answer and time. I will follow with marmot the rest of my code. – Hany Oct 28 '18 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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