Statalist The Stata Listserver


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

st: tmap question


From   Scott Cunningham <scunning@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: tmap question
Date   Mon, 2 Oct 2006 15:13:18 -0400

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/




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