## Re: st: legend on graph help

Svend Juul wrote, in response to Scott C and Scott M: > Personal view: I think the || notation is a lot less transparent than > the () notation. So I would write the above command: > > twoway /// > (line mpg price if fore == 0 , sort lc(blue) lp(dash)) /// > (line mpg price if fore == 1 , sort lc(black)) /// > , /// > legend(order(1 "white sex ratio" 2 "black sex ratio"))

I aggree with most of the things Svend said, however, regarding the || notation I recently changed my mind. I meanwhile write commands like the above as follows:

twoway /// || line mpg price if fore == 0 , sort lc(blue) lp(dash) /// || line mpg price if fore == 1 , sort lc(black) /// || , legend(order(1 "white sex ratio" 2 "black sex ratio")

Note that I use || to start the plots instead of ending them as it is proposed in the manual. I admitt that the first mention of || is not necessary but I think that it makes the command at least as transparent as with the () notation. Moreover I think it is even nicer with longer plot-subcommands:

twoway /// || line mpg price /// if fore == 0 & whatever you like /// , sort lc(blue) lp(dash) bla bla bla bal bal /// || line mpg price /// if fore == 1 & some other exp /// , sort lc(black) etc etc etc etc /// || , legend(order(1 "white sex ratio" 2 "black sex ratio")

Using || or () is clearly a matter of taste, and I don't want to start arguing about it. However, what I am trying to say is that starting lines with || can also help to structure long graph commands.

Uli

-- kohler@wz-berlin.de +49 (030) 25491-361 * * 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/

Tag: