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: Multiple single-variable stacked bar charts on the one axis


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Multiple single-variable stacked bar charts on the one axis
Date   Mon, 8 Apr 2013 09:51:51 +0100

For the record:

1. David recommended Naomi Robbins' book, which I endorse strongly. From

http://www.nbr-graphs.com/resources/recommended-books/

it is evident that the reference should be

Robbins, N.B. 2005, reissued June 2013.
Creating More Effective Graphs.
Chart House [originally Wiley-Interscience]

2. Natalie referred to -catplot-

 -catplot- is a user-written program from SSC

and to -grc1leg-

-grc1leg- is a user-written program from http://www.stata.com/users/vwiggins

Nick
[email protected]

On 8 April 2013 04:08, Natalie Herd <[email protected]> wrote:

> Thanks for your advice David and Nick...I will look into some
> alternative charts.

On Sun, Apr 7, 2013 at 10:15 PM, David Hoaglin <[email protected]> wrote:

>> 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).

>> 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
>> <[email protected]> wrote:

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