Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: percent symbols in catplot |

Date |
Sun, 28 Feb 2010 17:39:36 -0000 |

Eric started a thread under this heading which featured various exchanges with Martin Weiss. Replying to the original question: I am the author of -catplot-. The main issue is that -catplot- is purely a wrapper for -graph bar-, or -graph hbar- or -graph dot-, one of which is called depending on whatever is specified. In Eric's example -graph bar- is invoked. I confirm that I don't know a way to do this with high-level commands, as -graph bar- doesn't offer any such handle. A similar graph is possible with -tabplot- from SSC, at present with a kludge sysuse auto, clear contract rep78, perc(_perc) nomiss gen toshow = string(_perc, "%3.2f") + "%" tabplot rep78 [aw=_perc] , showval(toshow) That kind of thing is much easier as -tabplot- is based on -twoway-. I have previously resisted the idea of being able to add "%" signs everywhere. Isn't a specification of percent on the graph margins sufficient? However, I'd add such an option to -tabplot- if it were clear that there were people who really wanted it. Nick n.j.cox@durham.ac.uk Eric Booth I am using -catplot- (from SSC) on Stata 11 MP for Mac OSX. I'd like to show the percent sign in the label for each of the category bars when using the "percent" option. For example, **** webuse auto, clear catplot bar rep78, percent blabel(bar, position(outside) format(%9.1f)) **or** catplot bar rep78, by( for) percent blabel(bar, position(outside) format(%9.1f)) **** shows the percent of each rep78 category out of 100, but I can't get it to show the % sign, so it could say "43.5%", etc. Using graph editor, I found that I can add a % sign to the bar label text manually (though I'd rather not have to do that for many graphs), but after looking through the barlabel options help documentation, I couldn't figure out how to change the bar label automatically. (I had the idea that if I could override the bar labels like you can the text for a key in a legend then I could calculate and substitute these values into the -catplot- command in a loop, but I haven't found a way to do this using the barlabel option) Another option might be to write something that automates those graph recorder grec file changes (ex: when I add the "%" by hand, it issues the command: .plotregion1.barlabels[3].text.Arrpush 43.5% in the recording), but this is a pain. Any suggestions? * * 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: RE: percent symbols in catplot***From:*Eric Booth <ebooth@ppri.tamu.edu>

**References**:**st: percent symbols in catplot***From:*Eric Booth <ebooth@ppri.tamu.edu>

- Prev by Date:
**Re: st: test for clustering in instrumental variables settings** - Next by Date:
**Re: st: RE: Display of Shea's partial R^2 in ivreg2 output** - Previous by thread:
**Re: st: RE: percent symbols in catplot** - Next by thread:
**Re: st: RE: percent symbols in catplot** - Index(es):