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: mylabels axis label alignment with comma format


From   "Dimitriy V. Masterov" <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: mylabels axis label alignment with comma format
Date   Fri, 13 Sep 2013 16:50:39 -0700

Nick,

That fixes the alignment, but does not display the commas:

mylabels 1 300 6000 18000, myscale(ln(@)) local(labels) format(%2.0fc)
0 " 1" 5.703782474656201 "300" 8.699514748210191 "6000"
9.798127036878302 "18000"



On Fri, Sep 13, 2013 at 4:44 PM,  <[email protected]> wrote:
> Try %2.0fc
>
> Nick
> [email protected]
>
> On 13 Sep 2013, at 19:04, "Dimitriy V. Masterov" <[email protected]> wrote:
>
>> Nick,
>>
>> You can see the extra spaces in the second one. When the range of the
>> x-axis gets large, the gap becomes much more pronounced:
>>
>> . mylabels 1 300 6000 18000, myscale(ln(@)) local(labels)
>> 0 "1" 5.703782474656201 "300" 8.699514748210191 "6000" 9.798127036878302 "18000"
>>
>> . mylabels 1 300 6000 18000, myscale(ln(@)) local(labels) format(%6.0fc)
>> 0 " 1" 5.703782474656201 " 300" 8.699514748210191 " 6,000"
>> 9.798127036878302 "18,000"
>>
>> DVM
>>
>> On Thu, Sep 12, 2013 at 11:28 PM, Nick Cox <[email protected]> wrote:
>>> Can you show us the contents of the local macro? Is -mylabels- producing a
>>> crazy macro or -kdensity- being awkward? (I can't experiment with Stata
>>> right now.)
>>>
>>>
>>> On 13 Sep 2013 at 03:39, "Dimitriy V. Masterov" <[email protected]> wrote:
>>>
>>>> I am having trouble getting small values to align correctly when using
>>>> the comma format and Nicholas Cox's -mylabels-. The first kernel
>>>> density plot below looks great, but when I try to format the axis
>>>> labels, the numbers on the left drift too far to the right.
>>>>
>>>> sysuse auto, clear
>>>> replace price = price/100 if price <5000
>>>> gen lnp=ln(price)
>>>> mylabels 1 300 6000 18000, myscale(ln(@)) local(labels)
>>>> kdensity lnp, xlabel(`labels')
>>>> mylabels 1 300 6000 18000, myscale(ln(@)) local(labels) format(%6.0fc)
>>>> kdensity lnp, xlabel(`labels')
>>>>
>>>>
>>>> DVM
>>>> *
>>>> *   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/
*
*   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