Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: tmap question


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: tmap question
Date   Mon, 2 Oct 2006 14:37:17 -0500

The uscoord.dta contains the outlines of the states.  The first observations
are:

_ID	_X	_Y
1		
1	-9618628.4	4865253.1
1	-9623409.2	4865611.5
1	-9622746.7	4854244.4
1	-9615432.3	4846464.9
1	-9627468.7	4854868.1
1	-9629634.2	4863573.2

Use the us-database.dta file to add state name or abbreviations to the map.
This file contains the centroid coordinates.


Scott


> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Scott Cunningham
> Sent: Monday, October 02, 2006 2:13 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: tmap question
> 
> I'm using tmap 2.0 and had a question about the addplot() command.  I
> have a variable called "sr" which is the ratio of women to men at the
> United States state level.  I would like to have added to the map the
> abbreviation for each of the United States states.  I appear to be
> having trouble with the xplot and yplot syntax within addplot.  For
> instance, here is the simple map I've made without the addplot.
> 
> tmap choropleth sr if id!=13 & id!=56, id(id) map(uscoord.dta) palette
> (Blues) title(`"`"Sex Ratios for 18-24 year-olds, 2000"'"') subtitle
> ("White Americans")
> 
> I would like to now add the state abbreviation to the map, making it
> easier to interpret.  I'm reading a user guide written by Maurizio
> Pisati, and he writes that addplot requires the x- and y-coordinates
> of the variable name.  Contained in uscoord.dta are 3 variables:
> _ID, _X and _Y.  So I type the following:
> 
> tmap choropleth sr if id!=13 & id!=56, id(id) map(uscoord.dta) palette
> (Blues) title(`"`"Sex Ratios for 18-24 year-olds, 2000"'"') subtitle
> ("White Americans") addplot(label sr if id!=13 & id!=56, x(X) y(Y))
> 
> But this elicits an error, saying that the syntax for addplot is
> incorrect.  I am assuming that the problem lies with the use of the
> x- and y-coordinates.  And reading through Dr. Pisati's user guide
> more closely, I notice in an example that his x- and y-coordinates
> appear to be in the main using file - not in his coordinates file.
> 
> Here's the variables I have for me main file:
> 
> STATE
> NAME
> FIPS
> LON
> LAT
> id
> fip
> sr
> 
> Any help is appreciated.
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index