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: horizontal box plots and log scale
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: horizontal box plots and log scale
Date
Thu, 13 Sep 2012 07:01:52 +0100
I am no longer very clear on your real problem or how it led to your
first post.
But if the values given are like your data, which are relative risks
for various situations or studies, then I would not reach for a box
plot at all. I would want to see all the values and so would use -
graph dot- or -stripplot- (SSC) with an -over()- option. Such commands
allow text labels for each value.
When some values are very close together -devnplot- (SSC) can work
better than -stripplot-. There is an example in my San Diego
presentation, downloadable from the Stata website.
Nick
On 12 Sep 2012, at 22:58, Susanna Cramb
<[email protected]> wrote:
Thanks so much Nick for your very prompt reply.
I had seen the FAQ... My sole reason for the transformation is to
obtain equally spaced ticks for the values 0.4, 0.5, 0.66, 0.8, 1.0,
1.25, 1.5, 2.0, 2.5 (as it's using relative risk) so I didn't think
it was necessary/desirable to transform the data. (Incidentally, I
also tried -stripplot-, but had the same problem).
However, if that is the only option, then obviously that will have
to do.
Thanks again,
Susanna
-----Original Message-----
From: [email protected] [mailto:owner-
[email protected]] On Behalf Of Nick Cox
Sent: Wednesday, 12 September 2012 7:04 PM
To: [email protected]
Subject: Re: st: horizontal box plots and log scale
This is a FAQ. See
FAQ . . . . . . . . . . . . . . . . . . . Box plots and
logarithmic scales
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
N. J. Cox
9/05 How can I best get box plots on logarithmic scales?
http://www.stata.com/support/faqs/graphics/boxandlog.html
The essence of the problem is that -xsc(log)- just takes the graph
you would have otherwise and transforms it logarithmically. You must
transform the data first, draw the box plot, and then fix the axis
labels.
-mylabels- (SSC) may help with the last.
I think you are wrong about Stata version here: this is in principle
a problem with any version of Stata and a wired in boxplot command.
Nick
On Wed, Sep 12, 2012 at 9:53 AM, Susanna Cramb <[email protected]
> wrote:
I am having difficulties in generating horizontal box plots on the
log scale.
I am using Stata/SE 12.1 for Windows (32-bit), although I also have
the problem with the same version under (64-bit) and also Stata/SE
11.2 for Windows (32-bit). I did not have this problem when using
earlier versions of Stata.
If I run the following example from the graph box help file, Stata
generates the graph as expected:
sysuse nlsw88, clear
graph hbox wage, over(ind, sort(1)) nooutside ytitle("") title
("Hourly
wage, 1988, woman aged 34-46", span) subtitle(" ") note( "Source:
1988 data from NLS, U.S. Dept. of Labor, Bureau of Labor
Statistics" ,
span)
However, if I request it on the log scale, as in the following
code, I obtain a horizontal box plot where all the categories are
squished on top of each other at the very top of the graph, while
the horizontal axis remains unchanged.
sysuse nlsw88, clear
graph hbox wage, over(ind, sort(1)) nooutside ytitle("") title
("Hourly
wage, 1988, woman aged 34-46", span) subtitle(" ") note( "Source:
1988 data from NLS, U.S. Dept. of Labor, Bureau of Labor
Statistics" ,
span) yscale(log)
Has anyone else had this problem, and is there any solution?
*
*
* 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/