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:
Simon Jackman <[log in to unmask]>
Reply To:
Political Methodology Society <[log in to unmask]>
Date:
Mon, 8 May 2006 18:26:37 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (144 lines)
or, using a free piece of software... http://cran.r-project.org/

x <- c(.05,.27,.56,.47,.5,.53,.75,.82,.68,.9)  ## data
y <- c(.1,.3,.35,.5,.5,.67,.7,.45,.9,1)

plot(x,y,type="n")            ## set up plot area but no points
polygon(x=c(.45,.45,.55,.55),
              y=par()$usr[c(3,4,4,3)],  ## vertical limits of plot
              col=gray(.45),   ## desired color
              border=F)         ## no border
points(x,y)                     ## now overlay points

[not that this list should become a software help thing, btw ]

-- simon jackman

On May 6, 2006, at 10:28 AM, Moshe Haspel wrote:

> Jamie,
>
> There's probably a better or (certainly more elegant) way to
> accomplish
> this, but overlaying a "range plot with area shading" (rarea)
> should do as
> a quick and dirty solution.
>
> Let's say you had the following 10 data points and wanted to do a
> scatterplot:
>
> IV      DV
> .1      .05
> .3      .27
> .35     .56
> .5      .47
> .5      .5
> .67     .53
> .7      .75
> .45     .82
> .9      .68
> 1       .9
>
> 1) create 2 addidional observations to anchor the minimum and maximum
> values of your IV (we started with 10 data points, so we need 12
> all day).
>
> set obs 12
>
> 2) create 2 new variables to form the boundaries of your reference
> area.
>
> gen ref45 = .45
> gen ref55 = .55
>
> 3) set the new observations to hold the minimum and maximum values for
> your IV (For this example, let's assume that the IV has a theoretical
> range of 0 to 1).
>
> replace IV = 0 in 11
> replace IV = 1 in 12
>
> 4) graph! You'll want to customize this output (especially the legend)
> further... but this should get you headed in the right direction.
>
> twoway rarea ref45 ref55 IV, sort bcolor(gs14) || scatter DV IV
>
> NB: STATA does its graphs in the order specified. So if you do scatter
> before rarea, the shading will block out any points within the
> reference
> area. The sort option makes certain that the reference box will
> cover the
> entire area. The bcolor option makes the box in a light gray so
> that the
> points will show up well.
>
> =============================================
> Moshe Haspel, Ph.D.
> Assistant Professor, Department of Political Science
> Spelman College
> Giles 215
> 350 Spelman Lane SW, Box 207
> Atlanta, GA  30314
> 404-270-5654 (phone)
> 404-270-5666 (fax)
>
> Political Methodology Society <[log in to unmask]> wrote on
> 05/05/2006 05:26:17 PM:
>
>> I'm creating a graph in STATA with a yaxis scaled 0 to 1. I want
>> to put
> a
>> shaded region between y = .45 and y = .55.  Could someone suggest
>> how to
> do
>> this?
>>
>> Thanks,
>> Jamie Chandler
>> CUNY Grad Center
>>
>> **********************************************************
>>              Political Methodology E-Mail List
>>         Editor: Karen Long Jusko <[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
>>
>> **********************************************************
>
> **********************************************************
>              Political Methodology E-Mail List
>         Editor: Karen Long Jusko <[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
>
> **********************************************************

Simon Jackman, Assoc Prof and Director of Graduate Studies,
Dept of Political Science and (by courtesy) Dept of Statistics,
Stanford University, Stanford, CA 94305-6044, USA.
http://jackman.stanford.edu
Director, Political Science Computational Lab. http://pscl.stanford.edu
Program Committee, useR! http://www.r-project.org/useR-2006/
ph: +1 (650) 723-4760  cell: +1 (650) 387 3019
fax: +1 (650) 724-9095

**********************************************************
             Political Methodology E-Mail List
        Editor: Karen Long Jusko <[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