Bookmark and Share

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


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

Re: st: Re: Make xline on top of graph?


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Re: Make xline on top of graph?
Date   Thu, 21 Jul 2011 13:43:33 -0500

Let's suppose you want lines at x = 1000, 2000, 4000. Superimpose on
top of your -twoway- graph call

|| scatteri 0 1000 1 1000 , recast(line) || scatteri 0 2000 1 2000 ,
recast(line) || scatteri 0 4000 1 4000 , recast(line)

You will want to tweak widths, colours, etc. as well.

In many fields triangular plots (many alternative names exist) are
used for such data. -triplot- from SSC is a Stata implementation.

An easy alternative is to plot (var2 - var1) versus var3 which
preserves the information in the three variables. For example, U.S.
elections can be plotted in terms of

(Republican vote - Democrat vote) vs sum of independent votes

which is not too difficult to think about. Even if the x variable is a
nonsense dimension, it spreads out the data.

I reviewed some possibilities in this field at the 2008 London users'
meeting. http://www.stata.com/meeting/uk08/abstracts.html

Nick

On Thu, Jul 21, 2011 at 11:39 AM, Paul Burkander <[email protected]> wrote:

> Here's my situation: I have about 5,000 observations and three key
> variables, I'll call them var1 var2 and var3.  Each is between 0 and
> one and the sum of the three variables is one.
>
> I'd like to have a graph that's sort of like a stacked bar chart to
> show the relative proportions of each variable across the 5000
> observations.  I've succeeded in doing this by using the twoway bar
> option.  I sort on var1, then graph var1+var2+var3, then var1+var2,
> then var1.  That part seems to have worked out fine.
>
> However, the 5000 observations fall into three distinct categories,
> and I'd like to first sort by these categories then by var1.  I'd like
> it to be clear where the demarcation between categories is.  I tried
> xline, but it seems to be drawn first, so that my bars are drawn over
> top if it and it can only be seen below 0 and above 1.  I don't see
> any option to make it be drawn on top.
>
> I also tried "graph combine," but there's a large difference in the
> number of observations in each category, and each of my separate
> graphs was being drawn with the same width, so the graph was
> misleading.

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