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

From |
Nick Cox <n.j.cox@stata.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: graph bar and/or catplot |

Date |
Mon, 29 Sep 2008 09:13:22 -0500 |

I don't understand quite what the problem is.

-catplot- is a user-written program from SSC. Please recall the advice to specify where user-written programs you refer to come from.

Users of -catplot- occasionally tickle a bug in -graph bar- that last I heard was not fixed and -- most importantly for b. water -- will never be fixed for Stata 8. There is an easy work-around. See

http://www.stata.com/statalist/archive/2008-05/msg00426.html

-catplot- here is just a wrapper for -graph bar- and doesn't behave in a fundamentally different way. In particular, neither knows anything about categories that might exist but do not show up in your data.

Your variable names suggest to me that you have two categorical variables on the same footing, which in turn leads me to suggest -tabplot- from SSC or -spineplot- from the SJ. There is some discussion in

SJ-8-1 gr0031 . . . . . . . . . . . Speaking Stata: Spineplots and their kin

(help spineplot if installed) . . . . . . . . . . . . . . . N. J. Cox

Q1/08 SJ 8(1):105--121

discusses spineplots (mosaic plots), a type of bar chart for

showing frequencies, proportions, or percentages of cross-

classified categorical variables

SJ-4-2 gr0004 . Speaking Stata: Graphing categorical and compositional data

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox

Q2/04 SJ 4(2):190--215 (no commands)

discusses graphical possibilities for categorical and

compositional data

Of these, -tabplot- can be persuaded to show bars of magnitude zero for cells that don't exist.

Nick

n.j.cox@durham.ac.uk

b. water wrote:

stata 8.2,i.e. none of the subejct reported 5, likewise with laser2. i want to create a graph ala [G] page 134 of Stata 8 [G]raphic manual, where the

my data set-up look something like this:

subject laser1 laser2

1 1 2

2 2 1

3 3 3

4 2 4

5 3 1

. . .

. . .

. . .

. . .

. . .

316 4 1

there were 316 subjects. laser1 has categories which take the values of 1 to 5 but returns from the subjects showed only categories 1 to 4

y-axis would show the total count of the subjects for each category while x-axis would show categories 1 to 5, with the chart itself consisting

of two bars of different colors for each laser1 and laser2.

the other thing is i also want to show on the graph is category 5 (i.e. value of 5) on the x-axis albeit it'll be empty i.e. 0, but where in using the

i tried various gr bar commands but just couldn't produce the kind of graphs that i want. using catplot e.g.:

catplot bar laser1 laser2, asyvars

came close but somehow it is showing 3 bars in some categories when it should only be showing two bars i.e. one for each laser1 and laser2 respectively.

above command, only 1 to 4 in the x-axis was displayed.

i would appreciate any advice/help either using the gr bar route or the catplot route or both to achieve what i wanted to show.

* * 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/

**Follow-Ups**:**RE: st: graph bar and/or catplot***From:*"b. water" <barleywater@hotmail.com>

**References**:**st: graph bar and/or catplot***From:*"b. water" <barleywater@hotmail.com>

- Prev by Date:
**Re: st: Test for trend in surveys** - Next by Date:
**Re: st: ml probit with nonlinear argument(s)** - Previous by thread:
**st: graph bar and/or catplot** - Next by thread:
**RE: st: graph bar and/or catplot** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |