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]

Re: st: RE: graph combine & single legend


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: graph combine & single legend
Date   Thu, 22 Sep 2011 13:41:58 +0100

No; I didn't say that. My few experiments imply that with a -by()-
option you only get part of the way with -grc1leg- and have to clean
up afterwards, but I am not the author and have not used the program
much, so you must look elsewhere for a more conVincing answer.

Nick

On Thu, Sep 22, 2011 at 1:38 PM, Oliver Jones
<ojones@wiwi.uni-bielefeld.de> wrote:
> Does this mean -grc1leg- can not handle the -by()- option?
>
> Am 21.09.2011 16:35, schrieb Nick Cox:
>>
>> My guess is that as your examples use -by()- you've picked an
>> especially tricky example for -grc1leg-. My experiments imply that you
>> need to clean up after -grc1leg- in the Graph Editor.
>>
>> This simpler example might be a better start.
>>
>> sysuse auto, clear
>> separate mpg, by(foreign) veryshortlabel
>> scatter mpg? weight, name(g1, replace)
>> scatter mpg? length, name(g2, replace)
>> scatter mpg? trunk,name(g3, replace)
>> grc1leg g1 g2 g3, legendfrom(g1) pos(4) ring(0)
>>
>>
>> On Wed, Sep 21, 2011 at 3:06 PM, Oliver Jones
>> <ojones@wiwi.uni-bielefeld.de>  wrote:
>>>
>>> Hi,
>>> I have the same problem as Ricardo.
>>> I tried using the -grc1leg- command, but I can not figure out how to use
>>> it.
>>> I always end up with all the legends for every graph and an additional
>>> one
>>> from using -grc1leg-.
>>> Thus my questions is: How do I create one single legend?
>>>
>>> The code I use is something like this:
>>>
>>> ************** Beginn example ****************
>>> sysuse xtline1, clear
>>>
>>> * Creating two more variable to mimic my data setup
>>> gen cal_yesterday = L.calories
>>> bysort person: gen first_half_year = (_n<  175)
>>>
>>> * Draw three scater plots
>>> scatter cal_yesterday calories day if person == 1, ///
>>>        by(first_half_year, title("Tess")) ///
>>>        name(g1)
>>> scatter cal_yesterday calories day if person == 2, ///
>>>        by(first_half_year, title("Sam")) ///
>>>        name(g2)
>>> scatter cal_yesterday calories day if person == 3, ///
>>>        by(first_half_year, title("Arnold")) ///
>>>        name(g3)
>>>
>>> * combine the three scatter plots
>>> grc1leg g1 g2 g3
>>> *************** End example *****************
>>>
>>>
>>> Kind regards
>>> Oliver
>>>
>>> Am 19.09.2011 19:10, schrieb Fiedler, James (JSC-SK)[USRA]:
>>>>
>>>> You might try the user-written command -grc1leg- (since 1's often look
>>>> like l's, that's "grc" + the numeral 1 + "leg").
>>>>
>>>> James
>>>>
>>>> ________________________________________
>>>> From: owner-statalist@hsphsun2.harvard.edu
>>>> [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Ricardo Ovaldia
>>>> [ovaldia@yahoo.com]
>>>> Sent: Monday, September 19, 2011 11:19 AM
>>>> To: statalist@hsphsun2.harvard.edu
>>>> Subject: st: graph combine&    single legend
>>>>
>>>> I want to combine 4 graphs, each a plot of three lines, using -graph
>>>> combine-. Because the legend for the graphs are all the same, I would
>>>> like
>>>> to have a single legend at the bottom. When I use -legend(off)- for
>>>> three of
>>>> the graphs, and leave the legend for the 4th graph, this 4th graph is
>>>> smaller than the rest when I combine them. Any solutions will be
>>>> appreciated.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index