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: -egenmore- grouping & graphing with -axis(varlist)-


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: -egenmore- grouping & graphing with -axis(varlist)-
Date   Thu, 29 Aug 2013 09:31:36 +0100

Thanks very much for the clarification.

In fact alignment of text when labels are really composite is
something I've struggled with myself, but here is a simple trick that
helps.

Forget -axis()- from -egenmore-, as official commands alone can do this.

. clonevar price2 = price

. graph hbar (asis) price, over(make) over(price2) nofill

Note that

. graph hbar (asis) price, over(make) over(price) nofill

doesn't work: the attempt to get -price- to play two roles is asking
too much, but a clone does the job.

However, this trick does depend on all the values of -price- being
distinct, with no ties. If there are ties in -price-, and so -price2-,
then the obvious choices seem reduced to

. graph hbar (asis) price, over(price2) over(make) nofill

I'll write this up somewhere.
Nick
[email protected]


On 29 August 2013 03:18,  <[email protected]> wrote:
> Thanks Nick,
> If I do the following,
>
> sysuse auto, clear
> keep if _n < 6
> keep make price
> egen var2 = axis(price make)
> graph hbar (asis) price, over(var2)
>
> it is difficult for the reader to follow price down the list of hbars,
> because the sub-label price is not aligned.
>
> If both price and make were aligned, as in the following example, then my
> readers will be able to following the graph clearly.
>
> egen var1 = axis(make price)
> graph hbar (asis) price, over(var1)
>
> For each label, I would like to have price before make, but I don't know
> how to do this while keeping them aligned.
>
> Mike.
>
>
>> I don't understand what you are asking here. You seem to be commenting
>> on how the labels look in some graph you haven't shown us. If so,
>> that's a question of -graph-. If not, please add further explanation.
>>
>> Nick
>> [email protected]
>>
>>
>> On 28 August 2013 15:58,  <[email protected]> wrote:
>>> Hi Folks,
>>> A version 8 user, here.
>>> I'm using the -egenmore- package from ssc (to install, type -ssc install
>>> egenmore-).
>>>
>>> Consider the following...
>>>
>>> sysuse auto, clear
>>> keep if _n < 6
>>> keep make price
>>> egen var1 = axis(make price)
>>> egen var2 = axis(price make)
>>> list
>>>
>>> I prefer the look of var1 because the two sub-labels are aligned.
>>> Specifically, the sub-labels of var1 are aligned by the last character
>>> in
>>> each sub-label. Would it be possible to align the two sub-labels of var2
>>> in the same way?
>>>
>>> Mike.
>>>
>>> *
>>> *   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/
*
*   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