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: Showing all categories in legend with catplot


From   Eric Booth <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: st: Showing all categories in legend with catplot
Date   Thu, 21 Jul 2011 03:42:56 +0000

<>

The help file for -catplot- (from SSC) mentions that it accepts other graph options, so you could use the legend() option to specify what you want, ex:

catplot q2 , over(newold) stack asyvars perc(newold) caption("Q2") ///
name(g2, replace)  legend(on order(1 "Agree" 2 "Neutral"  3 "Disagree" ) cols(1) )


- Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]


On Jul 20, 2011, at 7:40 PM, Martin Lee wrote:

> Hi
> 
> I'm having some problems with getting catplot to display all the
> categories in the legend for some questionnaire data where not all of
> the Likert scale response range is recorded for some of the questions. 
> 
> Example data and catplot command is below (q1 = question 1, q2 =
> question 2, newold = clinic type)
> 
> clear
> 
> inp byte(q1 q2 newold)
> 1 2 1
> 1 1 1
> 1 2 1
> 2 1 1
> 2 2 1
> 2 1 1
> 3 2 1
> 1 1 2
> 1 2 2
> 2 2 2
> 3 1 2
> 3 2 2
> end
> 
> lab def qlab 1 "Agree" 2 "Neutral" 3 "Disagree"
> lab val q1 q2 qlab
> 
> lab def nlab 1 "New" 2 "Old"
> lab val newold nlab
> 
> catplot q1 , over(newold) stack asyvars perc(newold) caption("Q1")
> name(g1, replace)
> catplot q2 , over(newold) stack asyvars perc(newold) caption("Q2")
> name(g2, replace)
> 
> And as you will see, for Q2, the legend only shows the "Agree" and
> "Neutral" responses.
> 
> How do I get all the categories to display?
> 
> Thanks in anticipation
> 
> Martin
> 
> Dr Martin Lee
> Public Health Dentist
> Clinical Director
> Community Dental Service
> 
> 
> 
> *
> *   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/




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