Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: Offsetting xlabels in scatter plot


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Offsetting xlabels in scatter plot
Date   Wed, 26 Oct 2011 19:06:32 +0100

. scatter mpg m, xla(, valuelabels alternate)

Documented at -help axis label options-. 

I would still recommend -graph dot- for this kind of thing. 

Nick 
n.j.cox@durham.ac.uk 

Bert Jung

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)


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