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: RE: twoway, xscale( exp )?


From   Stas Kolenikov <[email protected]>
To   [email protected]
Subject   Re: st: RE: twoway, xscale( exp )?
Date   Fri, 12 Aug 2011 12:49:41 -0400

Nick,

thanks, that's how this probably should be done. Official-Stata-only
workaround I found is

gen zero = 0
twoway (kdensity lprice) (hist lprice) (line zero price, xaxis(2)
xlab(4000(2000)16000, axis(2) ) xsc( log axis(2) ) lstyle(none) ) ,
legend( order(1 2) )

I cannot call it elegant, but it did the trick.

On Fri, Aug 12, 2011 at 12:19 PM, Nick Cox <[email protected]> wrote:
> I've pointed out a few times that Stata's "nice" labels for logarithmic scales don't work well and some unfinished code in a program not yet released is an attempt to do better.
>
> Two things of mine in this territory that are public are
>
> mylabels from http://fmwww.bc.edu/RePEc/bocode/m
>    'MYLABELS': module for axis labels or ticks on transformed scales or for
>    daily dates / mylabels and myticks generate axis labels and ticks on /
>    transformed scales. Their use is best explained by example. You / draw a
>    graph and one axis is on a transformed square root scale. / You wish the
>
> SJ-8-1  gr0032  . . . . . . .  Stata tip 59: Plotting on any transformed scale
>        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
>        Q1/08   SJ 8(1):142--145                                 (no commands)
>        tip on how to graph data on a transformed scale
>
> In this case, something like
>
> . mylabels 4000(2000)16000, myscale(ln(@)) local(lbl)
>
> And you then use `lbl' within -xla()-.
>
> Nick
> [email protected]
>
> Stas Kolenikov
>
> I have performed some analysis for a variable in its log scale, and I
> wanted to graph these results (a moderately complex combination of
> several -twoway- plots) showing the original scale of the variable.
> There is -xscale( log )- option to go from $ to log($) for income
> distributions and from OR to logit coefficients in binary models, but
> I could not find an option that goes the other direction to
> exponentiate things for labeling purposes. Is it possible to
> meaningfully emulate it? I have logs in the range of about 5 to 10
> which translate to levels in the thousands range, so putting them on
> the same graph, while technically possible, leads to totally obscure
> (and simply wrong) pictures.
>
> As an example, think about
>
> sysuse auto, clear
> gen lprice = log(price)
> twoway (kdensity lprice) (hist lprice)
>
> My idea is to have something like -twoway ... , xaxis(1 2)- with the
> second axis showing the original dollar amounts.
>
> *
> *   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/
>



-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index