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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Multiple single-variable stacked bar charts on the one axis


From   Natalie Herd <natalie@empiricaresearch.com.au>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Multiple single-variable stacked bar charts on the one axis
Date   Mon, 8 Apr 2013 13:08:12 +1000

Thanks for your advice David and Nick...I will look into some
alternative charts.
Cheers, Natalie

________________________________



Natalie Herd PhD, Director of Social Research
natalie@empiricaresearch.com.au | +61 417 594 775
214 Kerr Street, Fitzroy, Victoria 3065  | +61 3 9416 5006
PO Box 399116, Miami Beach, FL 33239  | +1 213 300 5957
empiricaresearch.com.au|
Usual work days - Tuesday, Wednesday, Friday




On Sun, Apr 7, 2013 at 10:15 PM, David Hoaglin <dchoaglin@gmail.com> wrote:
> Natalie,
>
> Stacked bar charts are usually an inferior way to display data.  The
> book by Naomi Robbins (2005) has an accessible discussion of some
> alternatives.  As a summary, it says, "Stacked bar chart: Do not use,
> because of their perceptual problems."  Better displays have been
> available in the literature on statistical graphics for some time.
> See, for example, the book by Cleveland (1985).
>
> David Hoaglin
>
> Cleveland, WS (1985).  The Elements of Graphing Data.  Wadsworth
> Advanced Books and Software.  (Revised edition: Hobart Press, 1994)
>
> Robbins, NR (2005).  Creating More Effective Graphs.  Wiley-Interscience.
>
> On Sun, Apr 7, 2013 at 5:54 AM, Natalie Herd
> <natalie@empiricaresearch.com.au> wrote:
>> Hi Statalist!
>>
>> I am trying to create a stacked bar chart of 10 categorical variables
>> (3 categories per variable) on a single axis (i.e., 10 separate bars,
>> with the %s for each of the 3 categories stacked on top of one
>> another).
>>
>> The variables are fit1_cat thru fit10_cat.
>>
>> I have tried the following options:
>>
>> 1) I can get a single stacked bar for one variable by using the
>> following syntax:
>>
>> tab fit1_cat,g(fit1_cat_v2)
>>
>> graph hbar fit1_cat_v21-fit1_cat_v23, stack percent l1title(var 1)
>>
>> 2) Alternatively, I can also get a single stacked bar using catplot:
>>
>> catplot fit1_cat, asyvars stack percent l1title(var 1)
>>
>> 3) The final approach I have tried is running the 10 stacked bar
>> charts separately and then using grc1leg to combine them:
>>
>> grc1leg c1.gph c2.gph c3.gph c4.gph c5.gph c6.gph c7.gph c8.gph c9.gph
>> c10.gph, cols(1) imargin(0 0 0 0) ycommon xcommon legendfrom(c2.gph)
>>
>> Unfortunately, this last approach squashes the bottom bar due to the
>> presence of the y scale (something that I have excluded from all of
>> the other bars).  I could just have no y scale, but that would not be
>> ideal.
>>
>> Is there a better way to achieve this type of chart?
>>
>> As an aside, is it possible to change the angle of the bar label
>> l1title, so that it runs horizontally rather than vertically?
>>
>> Thanks, Natalie
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index