8

How can I draw with tikz the irregular shaded area and (similarly?) the irregular frame around nodes like the ones in the image?

gaming analysis

0

2 Answers 2

7

A simple and quick example for Carol

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,shapes.geometric,calc,backgrounds}
\begin{document}
\begin{tikzpicture}
\matrix (gamea) [matrix of nodes,nodes={circle,draw},row sep=5mm,column sep=5mm]{
 & 1 &\\
 2& |[draw=none]|3 & 4\\
 |[draw=none]| 5 & 6 & |[draw=none]|7\\
 & |[draw=none]|8 &\\
};
\draw ($(gamea-3-1)!0.5!(gamea-4-2)$) ellipse [x radius=1.2cm, y radius=0.30cm,rotate=-45];
\draw ($(gamea-2-2)!0.5!(gamea-3-3)$) ellipse [x radius=1.2cm, y radius=0.30cm,rotate=-45];
\begin{scope}[on background layer]
\fill[black!20,rounded corners] ([xshift=-2mm]gamea-2-3.west) arc (180:0:5mm and 5mm) -- 
                    ([xshift=1mm]gamea-3-3.east) arc (0:-90:1cm and 1.5cm) arc 
                    (-90:-180:1cm and 0.8cm) |- ([shift={(3mm,2mm)}]gamea-3-2.north east) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

5
  • Basically its Carol and Alice as they are ''mirror images'' Mar 7, 2012 at 5:05
  • @TomBombadil except one more ellipse ;)
    – percusse
    Mar 7, 2012 at 7:05
  • D'oh, you're right, I totally missed that. But going from your solution it shouldnt be too hard ;) Mar 7, 2012 at 12:26
  • I have another question: how to align those A, B and C graph on the same line with appropriate separation? Use multiple tikzpicture environments or there is a easier way? I think it will overlap if I put different code in one environment.
    – FloydChen
    Mar 7, 2012 at 23:57
  • 1
    @FloydChen You can put each of them into \begin{scope}[xshift=x cm] ..... \end{scope} environments in one tikzpicture and then play around with the x values of each scope to shift them. In other words, each scope will have its own coordinate system and you will be just moving them around independently.
    – percusse
    Mar 8, 2012 at 0:18
5

A minimal approach for Beatrice:

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\node (1) at (1,0) {1};
\foreach \x in {2,...,4}
{   \node (\x) at (\x-2,-1) {\x};
    \pgfmathtruncatemacro{\seli}{\x+3}
    \node (\seli) at (\x-2,-2) {\seli};
}
\node (8) at (1,-3) {8};
\fill[gray,rounded corners=2mm,even odd rule,opacity=0.25]  ($(3.north) + (0,0.2)$) -- ($(7.east) + (0.2,0)$) -- ($(8.south) + (0,-0.2)$) -- ($(5.west) + (-0.2,0)$) -- cycle (3.south) -- (7.west) -- (8.north) -- (5.east) -- cycle;

\draw (1) circle (0.2);
\draw (2) circle (0.2);
\draw (3) circle (0.2);
\draw (5) circle (0.2);

\draw (4.west) to[out=90,in=90,looseness=2] (4.east) -- (7.east) to [out=270,in=270,looseness=2] (7.west) -- cycle;
\draw (6.west) to[out=90,in=90,looseness=2] (6.east) -- (8.east) to [out=270,in=270,looseness=2] (8.west) -- cycle; 

\end{tikzpicture}

\end{document}

enter image description here


And for Communal:

\begin{tikzpicture}
\node (1) at (1,0) {1};
\foreach \x in {2,...,4}
{   \node (\x) at (\x-2,-1) {\x};
    \pgfmathtruncatemacro{\seli}{\x+3}
    \node (\seli) at (\x-2,-2) {\seli};
}
\node (8) at (1,-3) {8};

\fill[gray,rounded corners=1mm,opacity=0.25]  ($(2.north west)+(-0.1,0.1)$) -- ($(4.north east)+(0.1,0.1)$) -- ($(7.south east)+(0.1,-0.1)$) -- ($(8.south east)+(0.1,-0.1)$) -- ($(8.south west)+(-0.1,-0.1)$) -- ($(5.south west)+(-0.1,-0.1)$) -- cycle;

\draw (1) circle (0.2);
\draw (2) circle (0.2);

\draw[rounded corners=1mm] (5.north west) -- (6.north west) -- (3.north west) -- (4.north east) -- (7.south east) -- (8.south east) -- (8.south west) -- (5.south west) -- cycle;

\end{tikzpicture}

enter image description here

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.