Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: Placement of legend above "note" in -grc1leg-


From   Tim Evans <Tim.Evans@wmciu.nhs.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Placement of legend above "note" in -grc1leg-
Date   Wed, 20 Feb 2013 13:03:38 +0000

Hi all,

In answer to my own query I found the following code in the -grc1eg- part does the trick:

For the -b1title- option, I have given the ring() value of 4, for the note, I then specified that the ring() is 6 (so below the b1title) and also specified the position as 7. This seems to be pretty much what I'm after.

New code:

*****
grc1leg One Two Three, cols(3) ycommon ///
		l1title("Life expectancy at birth (years)") ///
		b1title("Year", size(small)) ring(4) ///
		 note("Source: National Vital Statistics, Vol 50, No. 6" ///
                  "(1918 dip caused by 1918 Influenza Pandemic)", size(tiny) ring(6) pos(7))
****

Old code
*****

grc1leg One Two Three, cols(3) ycommon ///
		l1title("Life expectancy at birth (years)") ///
		b1title("Year", size(small)) ring(6) ///
		 note("Source: National Vital Statistics, Vol 50, No. 6" ///
                  "(1918 dip caused by 1918 Influenza Pandemic)")
Best wishes

Tim

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Tim Evans
Sent: 20 February 2013 11:39
To: statalist@hsphsun2.harvard.edu
Subject: st: Placement of legend above "note" in -grc1leg-

Hi all,

I'm using Stata 11.2 and trying to combine three graphs using the user-written -grc1leg-, however I'm having a little trouble in the placement of the legend and the insertion of a note. I'm trying to place the legend below the graph and centred and place the note that I want to add to the right and below the legend. Currently my code seems to place the legend below the note and despite attempts to play with "ring" and "pos" options for both legend and note, I just don’t seem to be able to place them in the desired order. I've got an example below. Any help greatly appreciated.

Best wishes

Tim

**BEGIN CODE**
sysuse uslifeexp, clear
       generate diff = le_wm - le_bm
       label var diff "Difference"

		   line le_male year ///
            ||, ///
             ylabel(0 (20)80,     gmax angle(horizontal)) ///
             ytitle("") title("Males") ///
			 xtitle(" ") ///
			 xlabel(, angle(45)) ///
                         legend(order( 1 "Trend" ) region(lwidth(none)) size(small) cols(2)) ///
           			 name(One, replace)	  
					 
	   line le_female year ///
            ||, ///
             ylabel(0 (20)80,     gmax angle(horizontal)) ///
			 xtitle(" ") ///
             xlabel(, angle(45)) ///
			 ytitle("") title("Females") ///
                         legend(order( 1 "Trend" ) region(lwidth(none)) size(small) cols(2)) ///
           			 name(Two, replace)	  
			 
		   	   line le_wmale year ///
            ||, ///
             ylabel(0 (20)80,     gmax angle(horizontal)) ///
             xtitle(" ") ///
			 ytitle("")  title("White males") ///
			 xlabel(, angle(45)) ///
                         legend(order( 1 "Trend" ) region(lwidth(none)) size(small) cols(2)) ///
           			 name(Three, replace)	  
		
grc1leg One Two Three, cols(3) ycommon ///
		l1title("Life expectancy at birth (years)") ///
		b1title("Year", size(small)) ring(6) ///
		 note("Source: National Vital Statistics, Vol 50, No. 6" ///
                  "(1918 dip caused by 1918 Influenza Pandemic)")

**END CODE**
_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.

*
*   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/

_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index