Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Offsetting xlabels in scatter plot

From   Bert Jung <>
Subject   st: Offsetting xlabels in scatter plot
Date   Wed, 26 Oct 2011 13:59:17 -0400

Dear Statalisters,

I trying to make a scatter plot with numerical values on the y-axis
and 3-4 labeled categories on the x-axis.  In this case it a scatter
of estimated coefficients from 3-4 different regressions where the
regression name is listed on the x-axis and the coefficient on the
y-axis (they're all the same scale).

My problem is that the category labels are quite long therefore
overlap.  I would like to offset every other label to avoid this
overlap.  I understand this can be done for the -bar- graph via
-over()- but how to do this for regular -twoways-?

I realize that I could make the graph horizontal and put the labels on
the y-axis.  But since they are quite lengthy I would need a second
row for each label.

In the following example I get a x-axis

AMC Concord      AMC Pacer     AMC Spirit     Audi 500

But what I want is every other label to be offset

AMC Concord                           AMC Spirit
                           AMC Pacer                          Audi 500

* Example - my labels are much longer

sysuse auto
encode make, gen( m )
keep if m<5
scatter mpg m, xlab( , valuelabels)

Thanks for any pointers,
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index