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: combine catplot graphs


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: combine catplot graphs
Date   Fri, 14 Mar 2014 01:40:39 +0000

-catplot- is from SSC. Please remember

I take the central question here to be showing both of

1. a detailed breakdown for individual categories
2. an overall breakdown for combined categories.

There have been at least two broadly similar questions recently. One was

http://www.stata.com/statalist/archive/2014-01/msg01098.html

with detailed replies by Scott Merryman and myself. Scott's trick of
temporarily adding a few extra observations is a good one, but in this
particular case I focus on
just temporarily duplicating the entire dataset.

Using the auto data, here is how I would approach an example with
similar flavour:

sysuse auto, clear
set scheme s1color
local np1 = _N + 1
preserve
expand 2
replace foreign = 2 in `np1'/L
label def origin 2 "All", modify
local opts bargap(20) ylabel(0(10)60, ang(h)) blabel(bar,
format(%4.1f)) vertical
catplot rep78 foreign, percent(foreign) `opts' name(g1, replace)
catplot rep78, by(foreign, row(1) note("")) percent(foreign) `opts'
name(g2, replace)
restore

A Tip on expanding for graphical ends is in press at the Stata Journal.

Nick
[email protected]


On 13 March 2014 17:34, Antonio Rodriguez Andres
<[email protected]> wrote:

> I am using the Stata command catplot and I want to analyse the prevalence of
> different mental health disorders. For that purpose
> I want to combine in the same graph two different types of the mental health
> disorders for the total population, male and females.
> Just a flavour of what I did
>
> catplot ditem4, asyvars bargap(20)ylabel(0 (10)100) blabel(bar,
> format(%4.1f)) showyvars legend(off) percent vertical name(g4) //feeling
> depressed Total Population
> catplot ditem4 if sex==1, asyvars bargap(20)ylabel(0 (10)100) title
> ("Males") blabel(bar, format(%4.1f)) showyvars legend(off) percent vertical
> //feeling depressed. Male
> catplot ditem4 if sex==2, asyvars bargap(20)ylabel(0 (10)100)
> title("Females") blabel(bar, format(%4.1f)) showyvars legend(off) percent
> vertical // Females
>
> I have the other mental health symptom
>
> catplot ditem5, asyvars bargap(20)ylabel(0 (10)100) blabel(bar,
> format(%4.1f)) showyvars legend(off) percent vertical //Anxiety
> catplot ditem5 if sex==1, asyvars bargap(20)ylabel(0 (10)100) title
> ("Males") blabel(bar, format (%4.1f)) showyvars legend(off) percent vertical
> //Anxiety
> catplot ditem5 if sex==2,  asyvars bargap(20)ylabel(0 (10)100)
> title("Females") blabel(bar, format(%4.1f)) showyvars legend(off) percent
> vertical //Anxiety
>
>
> It seems to me that the graph combine is not the solution. Any clue
*
*   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