Drawing veto players diagrams

October 28, 2010

For a long time I’ve not known how to produce, with minimum fuss, diagrams of veto players in political space, even in one dimension.

I’ve now bothered to learn some PGF syntax, for use within latex. Here’s come code, mostly stolen from an example by Till Tantau which will draw a nice example of instability in a two-dimensional three-member legislature. Image first, code after the break:
veto_players_test2


\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[dvipsnames]{xcolor} % [dvipsnames]
\usepackage{tikz}
\usetikzlibrary{calc,patterns}

\begin{document}
\maketitle
% START DOCUMENT HERE

\begin{tikzpicture}[scale=1]

%% First define our ideal points
\coordinate[label=above:$A$] (A) at (-2,2);
\coordinate[label=above:$B$] (B) at (2,0);
\coordinate[label=above:$C$] (C) at (-1,-2);

% middles of sides
\coordinate (A') at ($(B)!.5!(C)$); %%
\coordinate (B') at ($(A)!.5!(C)$); %%
\coordinate (C') at ($(B)!.5!(A)$); %%

\coordinate[label=0:$SQ$] (SQ) at (intersection of A--A' and B--B');

%% Now define circles with radius between the ideal point and the status quo position

\def\firstcircle{(A) let
\p1 = ($ (SQ) - (A) $)
in circle ({veclen(\x1,\y1)})}

\def\secondcircle{(B) let
\p1 = ($ (SQ) - (B) $)
in circle ({veclen(\x1,\y1)})}

\def\thirdcircle{(C) let
\p1 = ($ (SQ) - (C) $)
in circle ({veclen(\x1,\y1)})}

%% And draw them;
\filldraw [yellow, opacity=0.4] \firstcircle;
\filldraw [cyan, opacity=0.4] \secondcircle;
\filldraw [magenta, opacity=0.4] \thirdcircle;

%% Label the ideal points
\filldraw [gray] (A) circle (1pt);
\filldraw [gray] (B) circle (1pt);
\filldraw [gray] (C) circle (1pt);

%% We now draw grid lines which are centred upon the status quo position
\draw [help lines,step=1cm] let
\p1 = ($ (SQ) - (0,0) $)
in
[xshift={\x1}](-4,-4) grid (4,4);

%% Now draw axis lines

\draw let \p1
\p1 = ($ (SQ) - (0,0) $)
in
[<->](-4,\y1) -- (4,\y1) node[below=6pt,left=0pt]{Guns}
[<->](\x1,-4) -- (\x1,4) node[below=20pt,right=6pt,rotate=90]{Butter};

%% Now mark out the winset of the SQ by cross-hatching
\begin{scope}
\clip \firstcircle;
\fill[pattern=crosshatch dots] \secondcircle;
\end{scope}

\begin{scope}
\clip \secondcircle;
\fill[pattern=crosshatch dots] \thirdcircle;
\end{scope}

\begin{scope}
\clip \thirdcircle;
\fill[pattern=crosshatch dots] \firstcircle;
\end{scope}

%% And draw a little legend

\filldraw [pattern=crosshatch dots] (4.5,3) rectangle (5.5,3.5) node[below=6pt,right=1pt]{Winset of SQ} ;
\end{tikzpicture}

\end{document}

Unfortunately, the driver I use for Beamer presentations in xelatex doesn’t seem to support cross-hatching, so I have to get quite ugly…

tags: ,
posted in Uncategorized by Chris

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org