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]

st: Problem with graph


From   Amal Khanolkar <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Problem with graph
Date   Thu, 22 Aug 2013 15:51:10 +0000

Hi all,

I use the following syntax to generate a series of k-density curves to compare the distribution of my outcome of interest across different ethnic groups:

kdensity grdbs if ethnicity2==1 , generate(x_sweden y_sweden)
kdensity grdbs if ethnicity2==7 , generate(x_arab y_arab)
kdensity grdbs if ethnicity2==10 , generate(x_som y_som)
kdensity grdbs if ethnicity2==14 , generate(x_sasia y_sasia)
kdensity grdbs if ethnicity2==15 , generate(x_ethiop y_ethiop)
kdensity grdbs if ethnicity2==16 , generate(x_easia y_easia)
kdensity grdbs if ethnicity2==19 , generate(x_africa y_africa)


twoway (line y_sweden x_sweden, sort) ///
	   (line y_arab x_arab, sort) ///
	   (line y_som x_som, sort) ///
	   (line y_sasia x_sasia, sort) ///
	   (line y_ethiop x_ethiop, sort) ///
       (line y_easia x_easia, sort) ///
       (line y_africa x_africa, sort) ///
   ,   legend(order(1 "Sweden" 7 "Arab" 10 "Somalia" 14 "SouthAsia" 15 "Ethiopia" 16 "EastAsia" 19 "Africa"))



- The original ethnicity variables, as 22 categories, but above I specify only the ones I'm interested in (i.e. categories:1, 7, 10, 14, 15, 16 and 19).

- I get the plot I need with 7 curves - which looks very good - but for some reason Stata only specifies the legend (colour) for the first two categories (sweden and arab, but not the rest). Could anyone tell me why?

- Also, how do I know the default pattern (and order of colours used by Stata?

Thanks in advance,

Regards,

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