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: Problem with graph


From   William Buchanan <[email protected]>
To   [email protected]
Subject   Re: st: Problem with graph
Date   Fri, 23 Aug 2013 08:29:04 -0500

There are a couple things that you may want to clarify regarding your query.  Do you literally want "a single line" that identifies the mean of each curve (one line multiple means) or do you want "a single line" that identifies the mean for each curve (one vertical line per mean)?  In the latter case, the -xline()- option should be helpful.  Additionally, if you already have predefined values for each group, it may be easier to plot the means as individual points using -scatteri- or by adding text to the body of the graph.  

HTH,
Billy



On Aug 23, 2013, at 8:01 AM, Amal Khanolkar <[email protected]> wrote:

> Dear Joerg & David,
> 
> Thanks for the tips and help! Got my graph to work :)
> 
> Unfortunately the book isn't free online.
> 
> Using the same code below, how would I include a single line for the mean value of each curve (that is a line that drops down onto the x-axis). I wasn't able to find anything in the help file for twoway graphs.
> 
> kdensity grdbs if ethnicgraph==1 , generate(x_sweden y_sweden)
> kdensity grdbs if ethnicgraph==2 , generate(x_arab y_arab)
> kdensity grdbs if ethnicgraph==3 , generate(x_som y_som)
> kdensity grdbs if ethnicgraph==4 , generate(x_sasia y_sasia)
> kdensity grdbs if ethnicgraph==5 , generate(x_ethiop y_ethiop)
> kdensity grdbs if ethnicgraph==6 , generate(x_easia y_easia)
> kdensity grdbs if ethnicgraph==7 , 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" 2 "Arab" 3 "Somalia" 4 "SouthAsia" 5 "Ethiopia" 6 "EastAsia" 7 "Africa"))
> 
> 
> 
> Cheers,
> 
> /Amal.
> ________________________________________
> From: [email protected] [[email protected]] on behalf of Radwin, David [[email protected]]
> Sent: 22 August 2013 18:41
> To: [email protected]
> Subject: RE: st: Problem with graph
> 
> Amal,
> 
> Also, an excellent reference for graphics is "A visual guide to Stata
> graphics, Third Edition" by Michael N. Mitchell (2012).
> http://www.stata.com/bookstore/visual-guide-to-stata-graphics/index.html
> 
> David
> --
> David Radwin
> Senior Research Associate
> Education Studies Division
> RTI International
> 2150 Shattuck Ave., Suite 800
> Berkeley, CA 94704
> Phone: 510-665-8274
> 
> www.rti.org
> 
> 
>> -----Original Message-----
>> From: [email protected] [mailto:owner-
>> [email protected]] On Behalf Of Joerg Luedicke
>> Sent: Thursday, August 22, 2013 9:13 AM
>> To: [email protected]
>> Subject: Re: st: Problem with graph
>> 
>> On Thu, Aug 22, 2013 at 11:51 AM, Amal Khanolkar
> <[email protected]>
>> wrote:
>> <snip>
>>> 
>>> - 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?
>> 
>> The integer numbers in the legend option should refer to the order of
>> plots, _not_ to values in your variable -ethnicity2-. Try the
>> following instead:
>> 
>> legend(order(1 "Sweden" 2 "Arab" 3 "Somalia" 4 "SouthAsia" 5
>> "Ethiopia" 6 "EastAsia" 7 "Africa"))
>> 
>> BTW, you could also use -twoway kdensity- directly.
>> 
>>> 
>>> - Also, how do I know the default pattern (and order of colours used
> by
>> Stata?
>> 
>> see -help connect_options-, especially -lpattern()- and -lcolor()-
>> 
>> Joerg
> 
> *
> *   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/
> 
> *
> *   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/


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