Statalist The Stata Listserver


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

Re: st: tmap question


From   Maurizio Pisati <[email protected]>
To   [email protected]
Subject   Re: st: tmap question
Date   Mon, 02 Oct 2006 22:29:00 +0200

Dear Scott,
as you correctly noticed, the x- and y-coordinates of the label reference points MUST belong in the dataset currently in memory. Now, it looks like in your "main" file these coordinates are named LON and LAT. Therefore, provided LON and LAT are expressed in the same units as _X and _Y in the map file, your command should be:

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(LON) y(LAT))

Best,
Maurizio



At 21.13 02/10/2006, you wrote:

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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index