POLMETH Archives

Political Methodology Society

POLMETH@LISTSERV.WUSTL.EDU

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jeffrey Lewis <[log in to unmask]>
Reply To:
Political Methodology Society <[log in to unmask]>
Date:
Fri, 14 Sep 2007 15:02:47 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (63 lines)
Simon Jackman wrote:
> On Sep 14, 2007, at 7:18 AM, Raffael Himmelsbach wrote:
>> Dear all,
>> I am on the search for a solution of the following problem in R:
>
> [stuff deleted]
>
>>  But I
>> only want to shade the overlapping sections with simple lines, just
>> like the graphs in Tsebelis' "Veto Players".
>> I would be very thankful for any hints.

The gpclib package is pretty slick for this.  Here is a simple example 
with two overlapping circles.

library(gpclib)
makecirclepoly <- function(center,radius,numpts=1000) {
    theta <- seq(0,2*pi,length=numpts)
    verts <- cbind(center[1]+radius*cos(theta),center[2]+radius*sin(theta))
    return( as(verts,"gpc.poly") )
}

c1 <- makecirclepoly(c(0,0),1.1)
c2 <- makecirclepoly(c(1,1),1.1)

plot(append.poly(c1,c2),axes=FALSE,xlab='',ylab='')
plot(intersect(c1,c2),poly.args=list(density=20,angle=30),add=TRUE)
points(0,0,pch=19,cex=0.7)
points(1,1,pch=19,cex=0.7)

Simon mentioned that you could you use various GUI drawing tools which 
is certainly true. However, there is a huge advantage using a language 
like R (or tex) to do this.  Once you have you the basic framework it is 
easy to draw or redraw any configuration of winsets (or whatever) that 
you want without almost zero marginal effort.

Best,

Jeff



-- 
Jeffrey B. Lewis, Associate Professor 
Department of Political Science
University of California Los Angeles
Los Angeles CA 90095
t: 310.206.5295  f: 310.825.0778
w: http://www.polisci.ucla.edu/faculty/lewis

**********************************************************
             Political Methodology E-Mail List
   Editors: Melanie Goodrich, <[log in to unmask]>
            Delia Bailey, <[log in to unmask]>
**********************************************************
        Send messages to [log in to unmask]
  To join the list, cancel your subscription, or modify
           your subscription settings visit:

          http://polmeth.wustl.edu/polmeth.php

**********************************************************

ATOM RSS1 RSS2