Statalist


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

Re: st: Bar graph ordered by values of yvar


From   David Radwin <[email protected]>
To   [email protected]
Subject   Re: st: Bar graph ordered by values of yvar
Date   Thu, 13 Mar 2008 16:33:19 -0700

Friedrich,

Thank you for the suggestion. This graph is adequate, but I would like greater control over the spacing between bars as is typically done using the bargap or gap options. The reason would be to emphasize the comparison between college grads and non-college grads.

Is there a way to make the gaps between bars 2 and 3 and between bars 4 and 5 larger than the gaps between bars 1 and 2, bars 3 and 4, and bars 5 and 6?

David

At 7:09 PM -0400 3/13/08, Friedrich Huebler wrote:

David,

Here is one solution.

. sysuse nlsw88, clear
. foreach var of varlist hours wage tenure {
    sum `var' if collgrad == 0
    gen ncg`var' = r(mean)
    sum `var' if collgrad == 1
    gen cg`var' = r(mean)
  }
. keep in 1
. graph hbar ncghours - cgtenure, ascategory

Friedrich

On Thu, Mar 13, 2008 at 6:34 PM, David Radwin <[email protected]> wrote:
 Dear Stata-listers,

  I have a question analogous to one I asked last year that was
  graciously answered by Nick Cox
  (http://www.stata.com/statalist/archive/2007-08/msg00934.html).

  Rather than pose the question outright, I will illustrate with a
  example comparing college graduates with non-college graduates:

  . sysuse nlsw88, clear
  . graph hbar (mean) hours wage tenure, over(collgrad) showyvars

  give you a graph with the bars in the order, from top to bottom, of:

  1. mean hours for non-college grads
  2. mean wage for non-college grads
  3. mean tenure for non-college grads
  4. mean hours for college grads
  5. mean wage for college grads
  6. mean tenure for college grads

  But what I actually want is

  1. mean hours for non-college grads
  2. mean hours for college grads
  3. mean wage for non-college grads
  4. mean wage for college grads
  5. mean tenure for non-college grads
  6. mean tenure for college grads

  Is there a option, user-written program, or set of commands that
  would produce this graph?

  David
  --
  David Radwin, Principal Analyst // [email protected]
  Office of Student Research, University of California, Berkeley
*
*   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/

--
David Radwin, Principal Analyst // [email protected]
Office of Student Research, University of California, Berkeley
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index