Statalist


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

st: -pieplot- available from SSC


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: -pieplot- available from SSC
Date   Wed, 14 Oct 2009 13:15:58 +0100

Thanks to Kit Baum, a new package -pieplot- is now downloadable from SSC
for pie charts of categorical frequencies. Stata 8.2 is required. Use
-ssc- to install if interested. 

Some readers will be surprised that such a package is being posted --
doesn't Stata have -graph pie- already and aren't pie charts fairly
useless any way? Some readers will be particularly surprised that I have
written such a package, as I am not in general a fan of pie charts,
which are also widely regarded as graphically incorrect. In a word, the
explanation is: teaching. There is more beneath my signature if you care
to read it. 

Nick
[email protected] 

-pieplot- is a convenience command providing an alternative to -graph
pie, over()- for pie charts showing categorical frequencies.

-graph pie- supports three syntaxes. The first two are for calculating
pie charts from sums of supplied variables and are not of concern here.
The third is for counting observations in different categories.
-pieplot- offers an alternative syntax to this third syntax of -graph
pie-.

A disadvantage of this third syntax is that it is unlike any other graph
syntax in that no variable list is expected. In addition, it is unlike
other syntax that users may issue with categorical variables.  Thus
users must switch between (say) -tabulate yvar- and -graph pie,
over(yvar)- or -tabulate yvar xvar- and -graph pie, over(yvar)
by(xvar)-.  -pieplot- is thus offered as a bridge to ease learning of
the third syntax of -graph pie-.

Simple examples: 

-pieplot yvar- plots a pie chart showing the relative frequencies of the
distinct values of -yvar-. This is equivalent to -graph pie,
over(yvar)-. 

-pieplot yvar xvar- plots a set of pie charts showing the relative
frequencies of the distinct values of -yvar- for each distinct value of
-xvar-. This is equivalent to -graph pie, over(yvar) by(xvar)-. 

As an aid to learning the syntax of the ultimately more flexible -graph
pie-, the syntax used to call -graph pie- is echoed to the Results
window by -pieplot-.

By the way, I have a very strong sense of how difficult it can be to
optimise syntax. Anyone who doubts this should try designing or even
re-designing a few commands. There is a clear rationale for -graph pie-
to have the syntax it does, but it does not match my idiosyncratic
priorities. 

I never use pie charts myself, but some groups I teach ask about drawing
pie charts. Also, I aim to convince students that pie charts are usually
inferior to other graph forms, and to do that fairly requires a
comparison. It so happens that such students are never interested, so
far as I can recall, in the first two syntaxes of -graph pie-, so using
the command directly implies wading through two syntaxes that aren't
relevant and finding one that is, but which nevertheless looks a little
strange to many newish users. That's why I wrote -pieplot-. 

-pieplot- also contains a work-around for an existing bug in -graph
pie-. See the code if interested. 

Incidentally, the absence of an equivalent syntax 

graph bar, over(yvar) 

created a niche for various user-written commands.... 



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index