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: logarithmic graphing problem
From
"Dimitriy V. Masterov" <[email protected]>
To
[email protected]
Subject
Re: st: logarithmic graphing problem
Date
Thu, 2 Jun 2011 13:08:29 -0400
Nick,
Many thanks for the references. They proved very helpful.
For posterity, here's some code:
/* graph */
gen y = sign(outcome2)*abs(outcome2)^(1/3);
gen x = sign(outcome1)*abs(outcome1)^(1/3);
sum outcome2;
local ymax=round(ceil(`r(max)'),300);
local ymin=round(floor(`r(min)'),100);
local ylabel;
foreach n of num `ymin'(100)`ymax' {;
local ylabel `ylabel' `=sign(`n')*abs(`n')^(1/3)' "`n'";
};
sum outcome1;
local xmax=round(ceil(`r(max)'),100);
local xmin=round(floor(`r(min)'),100);
local xlabel;
foreach n of num `xmin'(100)`xmax' {;
di "`n' is `=sign(`n')*abs(`n')^(1/3)'";
local xlabel `xlabel' `=sign(`n')*abs(`n')^(1/3)' `"`n'"';
};
twoway scatter y x, xline(0) yline(0) mlab(variable) mlabangle(45)
xlab(`xlabel', ang(h)) ylab(`ylabel', ang(h));
*
* 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/