Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Missing x-axis labels when using graph twoway


From   "Garth Rauscher" <garthr@uic.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Missing x-axis labels when using graph twoway
Date   Thu, 16 Aug 2007 11:21:36 -0500

I have two probably simple questions about graphing in Stata. #1 involves
getting value labels to appear on the x axis. #2 involves sorting the graph
on a variable other than the x-axis variable.


#1
I have a dataset where each observation contains a string variable
("study_") and a point estimate and lower and upper confidence limits
associated with a single study. I want to plot these estimates and
confidence intervals, with magnitude of each estimate on the y-axis and
study information on the x axis. Apparently string variables are not allowed
with graph twoway, so I encoded a numeric variable (named study) from the
original string variable (named study_), containing the original strings as
value labels.
 

encode study_, generate(study)


This appears to have worked just as expected:

groups study study_ 

                     study                         study _          Freq.
Percent |
 
|---------------------------------------------------------------------------
------|
  |         BROWN (1992) WOM(0.2)           BROWN (1992) WOM(0.2)       1
5.26 |
  |        CAPLAN (2003) TOTAL(2)          CAPLAN (2003) TOTAL(2)       2
10.53 |
  |        DEGNAN (1992) TOTAL(2)          DEGNAN (1992) TOTAL(2)       1
5.26 |



groups study study_, nolabel

    study                 study _           Freq.   Percent |
  |---------------------------------------------------------|
  |     1           BROWN (1992) WOM(0.2)       1      5.26 |
  |     2          CAPLAN (2003) TOTAL(2)       2     10.53 |
  |     3          DEGNAN (1992) TOTAL(2)       1      5.26 |



However, when I go to graph these estimates using the numeric variable
study, the value labels for study do not appear on the x-axis.

scatter _se study || rcap hi_se lo_se study 


#2 I'd like to sort the graph in order of ascending standard error of the
estimate.

Neither.....

sort _se
scatter _se study || rcap hi_se lo_se study 

Nor....

scatter _se study, sort(_se) || rcap hi_se lo_se study 

Nor....

scatter _se study, sort(_se) || rcap hi_se lo_se study, sort(_se)

Will work.


Thanks in advance for help with these simple questions.


Garth Rauscher
Assistant Professor
SPH Epidemiology and Biostatistics
University of Illinois at Chicago
1603 W Taylor St (M/C/ 923)
Chicago, IL 60612
(312) 413-4317 phone
(312) 996-0064 fax
garthr@uic.edu <mailto:garthr@uic.edu>  email 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index