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

RE: st: Suggestions for Second Edition of A Visual Guide to Stata Graphics

From   Fred Wolfe <>
Subject   RE: st: Suggestions for Second Edition of A Visual Guide to Stata Graphics
Date   Wed, 25 Jul 2007 15:31:52 -0500

Thanks, again ...

Using actual percents, though, allows blabel(bar) (even if you can't add the % sign to it.


On your second, I get a clearer sense of what niggles.
My hint here is that often you don't to change anything
so long as the axis labels tell the story you want.
(Axis titles and other text must also tell the truth as
you want the reader to see it.)

Suppose you have a response that to Stata is a proportion in
[0,1] but that you want shown on a percent scale. Then something

yla(0 0.2 "20" 0.4 "40" 0.6 "60" 0.8 "80" 1 "100")

gets the labels you want and what the data are, really,
underneath is not important. Something like this can be
a little tedious, so one shortcut is -mylabels- on SSC
with which you can do

mylabels 0(20)100, myscale(@/100) local(labels)

... , yla(`labels')

That is, you tell -mylabels- that you

1. want certain text labels to be shown

2. have data that is on a different scale, and
give the mapping from one scale to another

3. want the labels put in a local macro.

It can be a close call, but this often saves
typing in the long run, especially with scales
more complicated than percents or proportions,
partly because in practice one often gets
slowed down by silly little typos when you do
it the direct way.


Fred Wolfe

> I reply with great deference. Nick is the master of graph programs.
> Perhaps I am wrong about the difficulty of this task.
> Consider subjects who take one or more of 10 drugs at two time
> periods. I want to show the proportion of subjects taking each of the
> drugs at time 1 and time 2.
> Drug 1   .................X................Y.........
> Drug 2   ........................X..Y................
> Drug 3  .. etc
> If each drug was a category within "alldrugs" I could do this easily
> (over(alldrugs)). Because this is not the case, I have to overlay two
> graphs, perhaps fiddle with scaling, and maybe multiply variables,
> and so on. Have I missed something easy?
> With respect to multiplying by 100, here's what I think I have to do.
> Either clone the variables of interest and multiply them by 100 or
> preserve, multiply, make the graph, restore. While this is a trivial
> task, it is also a nuisance.
> The issue that I am raising is not that these tasks are not doable,
> but that it takes time to do them. Sometime a lot of time if one is
> not so facile or if one is working with multiple data sets. I would
> rather spend time analyzing data than fiddling with graph code. So,
> it would be nice if a graph book could address a series of
> simplifying issues like this. Stata, lets me type -or- after logit or
> clogit so that I don't have to take the time to do exponentiate
> separately. Stata doesn't yet allow similar ease of use extensions
> such as I have specified.
> I hope I haven't missed something very easy. Michael Mitchell's book
> might add additional value by addressing a series of issues such as
> these and showing programs such as you have written to
> facilitate graphing.
> Fred
> At 12:34 PM 7/25/2007, you wrote:
> >Fred Wolfe replied to Michael Mitchell's request for suggestions
> >on a second edition of "A Visual Guide to Stata Graphics" with
> >several thoughts from his experience.
> >
> >I have extracted two comments here, which should be of
> >interest beyond the book and before any second edition appears:
> >
> > > For bar and dot graphs, orientation is almost exclusively
> to over()
> > > and by(). But I often have to make such graphs under circumstances
> > > where over groups are not mutually exclusive. For
> example, instead of
> > > having an over group for drugs that patients might take, I have
> > > situations where patients take more than one drug, making the over
> > > group option useless to me. So I would very much like to see an
> > > expanded section on handling overlapping groups - or non-grouped
> > > data. Too much group stuff for me, but perhaps not for others.
> >
> >I am not clear what the difficulty here is at all. Please give
> >a specific example or more detail.
> >
> > > Converting proportions to percentages is a frequent task. Maybe
> > > adding some lines of code to do simple tasks like this would be
> > > helpful.
> >
> >Sorry, but what's the complication to be explained here?
> >Multiplication by 100?

*   For searches and help try:

Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel +1 316 263 2125

*   For searches and help try:

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