2

I want to add the digram given below in my beamer presentation. I have tried this much till now

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw (O) circle (2.5);
\draw (O) circle (1.5);
\draw (O) circle (0.5);
\end{tikzpicture}
\end{document}

enter image description here

  • 2
    beamer class has nothing to do with your request. I suggest removing the tag and change the title to something with eclipse instead of beamer – koleygr Jan 24 '18 at 5:51
6

Just used the most basic and necessary commands I could imagine for this:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}
  \tikzstyle{every node}=[font=\scriptsize]
\coordinate (O) at (0,0);
\draw[fill=green!50!blue] (O) ellipse (2.9cm and 1.2cm);
\draw[fill=red] ([yshift=0.4cm]O) ellipse (1.4cm and 0.3cm) node[anchor=center]{NP-complete};
\draw[fill=green!45!yellow] ([yshift=-0.65cm,xshift=-0.45cm]O) ellipse (0.8cm and 0.3cm)node[xshift=-0.3cm](L){P};
\node at ([xshift=-1.1cm]L){NP};
\node[text width=2cm] (M)at ([xshift=4.2cm,yshift=1cm]O){Graph \\isomorphism};
\draw[-latex,red,thick] (M)--([xshift=1.6cm,yshift=-.2cm]O);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}

Output:

enter image description here

  • I think your forgot \begin{frame}-\end{frame}. Didn't you? – Ignasi Jan 24 '18 at 8:06
  • @Ignasi thanks... I used article and just changed that... Editing – koleygr Jan 24 '18 at 8:10
5

slightly more "advanced" ... used are nodes with elliptic shape and relative node placement by use of positioning library and recent tikz syntax:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{backgrounds, fit, positioning, shapes.geometric}

\begin{document}
\begin{frame}[fragile]
    \begin{center}
\begin{tikzpicture}[
node distance=3mm and 9mm,
     E/.style = {ellipse, draw, fill=#1,
                 minimum width=3em, inner ysep=2pt, inner xsep=0pt},
                    ]
\node (n1) [E=red!50] {NP-complete};
\node (n2) [E=green!30, below=of n1] {P};
\node (n3) [left=of n2] {NP};
\scoped[on background layer]
    \node (n4) [E=green!50!blue, fit=(n1) (n2) (n3)] {};
\coordinate[left=of n4.east] (n5);
\draw[latex-,very thick,red] (n5) -- ++ (15:2.2) node[align=left,right] {Graph\\ isomorphism};
\end{tikzpicture}
    \end{center}
\end{frame}

enter image description here

  • Nice approach (+1) The big disadvantage is this ping color there instead of mine ... Huge aesthetics difference. [I really want you to notice-compare the colors even if my choice was a matter of luck... but for some reason makes huge difference]... On all the other your answer is much (and not little) more advanced [in commands and knowledge] – koleygr Jan 24 '18 at 10:37
  • so far i was convinced, that i copy your color selection :-). let left color selection to op :-) – Zarko Jan 24 '18 at 10:46

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.