Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Labels in spmap


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Labels in spmap
Date   Mon, 16 Dec 2013 19:46:23 -0600

Here is an example creating a labels data set that has long region
names split into two lines.  Take a look at the Friuli-Venezia Giulia
and Trentino-Alto Adige regions in the north east.

This is adapted from Maurizio Pisati's message:
http://www.stata.com/statalist/archive/2012-09/msg00817.html


 use "Italy-RegionsData.dta", clear

 generate label = region

 keep id xcoord ycoord label
 gen length = length(label)
 split label if length > 15
 replace label1 = label if label1 == ""
 drop label
 reshape long label, i(id x y) j(labtype)
 drop if label == ""

 save "Labels.dta", replace

 use "Italy-RegionsData.dta", clear
 spmap using "Italy-RegionsCoordinates.dta", id(id) ///
 label(data("Labels.dta") x(xcoord) y(ycoord) ///
 label(label)  by(labtype) size(*0.7 ..) position(0 6) length(21))

Scott



>>> On Mon, Dec 16, 2013 at 5:06 PM, Alexis Captanian
>> <acaptanian@gmail.com>
>>> wrote:
>>> > Hi Statalist,
>>> >
>>> > I'm trying to fit labels into regions of a choropleth map, but many
>> of
>>> > the labels are spilling out of their respective regions and
>>> > overlapping with each other. I would like to solve this problem by
>>> > making some labels appear as two lines, but I do not know how to do
>>> > this. I'm using spmap in Stata 11.2 on a Mac.
>>> >
>>> > For example, instead of:
>>> >
>>> > Los Angeles
>>> >
>>> > I would like the label to appear:
>>> >
>>> > Los
>>> > Angeles
>>> >
>>> > Decreasing the text size did not solve the overlap problem.
>>> >
>>> > Any suggestions would be greatly appreciated. I'm new to Stata so I
>>> > apologize if this is extremely elementary. I searched the archives
>> and
>>> > other resources but didn't find an answer.
>>> >
>>> > Thank you very much,
>>> > Alexis Captanian
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index