[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: graph hbox with ylabel(angle())

From   David Airey <>
Subject   Re: st: RE: graph hbox with ylabel(angle())
Date   Tue, 17 Feb 2009 07:02:11 -0600

So that is 2 bugs in graph hbox. One I noted in the other thread on - graph hbox- where the justification option in the -graph editor- draws the y axis away from the plot proper, and this bug you describe.


On Feb 17, 2009, at 5:50 AM, Nick Cox wrote:

My experiments match yours. It looks like a glitch in the -graph- code.

You can do this something similar -- but not identical -- with
-stripplot- from SSC.

There's also scope for hybridising box plots and strip plots to get over
some of the limitations of box plots.

For example,

sysuse auto
egen loq = pctile(mpg), by(foreign) p(25)
egen upq = pctile(mpg), by(foreign) p(75)
stripplot mpg, ms(none) over(foreign) box(barw(0.2)) addplot(scatter
foreign mpg if !inrange(mpg, loq, upq))

Although it's not in the code above,

xla(, ang(45) labsize(small))

works with -stripplot- too.


tess stafford

As far as I understand, ylabel for "graph hbox" refers to the x-axis,
which is the axis that I am trying to modify. The angle suboption does
seem to work in over(var2,label(angle(45))), but this modifies the
y-axis labels and I am trying to modify the x-axis labels.

The ylabel command for hbar is just label() and is a suboption inside
of the over() option:

over(xxx, label(angle(forty_five)))

tess stafford

With regards to the "graph hbox" command, I cannot get the suboption
"angle()" to work with "ylabel". A simplified version of my code is:

graph hbox var1, over(var2) medtype(cline) medline(lcolor(none)) /*
*/ ylabel(2001.649 "Fa2001" 2002.422 "Sp2002" 2002.649 "Fa2002"
2003.422 "Sp2003",labsize(small) angle(45) grid)

The "labsize()" suboption seems to work fine, but the "angle()"
suboption does nothing. When I change the code to "graph box" instead,
"angle()" works fine. Similarly, "angle()" works fine for the other axis as in "over(var2,label(angle(45))). I don't understand why it won't work
for the ylabel.

Does anyone see anything wrong with my code? If not, is this a glitch
in the language? Can we trick it into working? I know I can manually go in and alter the angle of the labels once Stata has generated the graph,
but I will likely be making many of
these graphs over different groups in the data and potentially
tweaking different aspects of them so it would be very time consuming to
have to continually manually alter them.

I'm using Stata 10/MP, by the way.

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index