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

Re: st: -triplot- updated on SSC

From   David Airey <david.airey@Vanderbilt.Edu>
Subject   Re: st: -triplot- updated on SSC
Date   Wed, 4 Feb 2009 13:57:23 -0600

I don't recognize the data set in the help file examples. Is it available?


On Feb 4, 2009, at 1:17 PM, Nick Cox wrote:

Thanks to Kit Baum as usual, the -triplot- package has been updated on
SSC. Stata 9 is required. Use -ssc- to install or update if interested.

-triplot- is for triangular plots suitable for three variables that add
to a constant. Examples are three proportions adding to 1 or
equivalently three percents adding to 100%. Given the constraint of
adding to a constant, there are really only two pieces of information in
each observation for those variables and so a projection onto two
dimensions loses nothing. Several other names are in use for the same
plot, although many programs in different languages use the same name
-triplot-, as Google shows.

I talked about this kind of plot at the 2008 London meeting, and as
mentioned then as an intention, I now have updated it so that it
supports -by()-.

That raises more general points relevant to some issues discussed last
month in a thread on graphics programming started by Timothy Mak.

-triplot- shows data within a triangular frame, but to Stata it is just
a -twoway- plot. The explanation is mundane. I use standard options to
suppress the x and y axes and their various decorative ticks and labels.
I then define the triangular axes and their decorations using other
standard features to put lines, ticks (short lines) and labels (text) at precisely the right places. All the syntax is documented here and there in the Stata graphics manual. I really shouldn't explain this because it
will seem all too obvious when made plain.

The previous version did not support -by()- because the previous version
put the information for the axes etc. in the first few observations
being used. When -by()- was invoked, that information would end up
arbitrarily in one or other panel producing a bizarre effect. You might see a side of a triangle here and the other two sides in another panel, and so on. It would not be echoed to every panel as required. The upshot
was that I trapped calls to -by()- with an error message.

It took me a few years to realise that using -scatteri- and its
relatives accessible by -recast()- would produce the echoing I needed.
So I rewrote the program to do that. The more general program is almost
100 lines shorter, as so often happens.

I toyed with the idea that defining axes of triangular plots as classes
in Stata might possibly yield a neater solution to some other small
problems, but a few minutes' conversation with Vince Wiggins of
StataCorp disabused me of that idea. In short, not only are the
undocumented features unnecessary, trying to use them would make the
programming problem far more difficult than need be. Naturally, that
doesn't rule out classes being vital for other problems.

So, the moral is ancient: Almost anything graphical can be plotted as a
-twoway- plot if you try hard enough. (However, I wouldn't try to draw
pie charts like that.)


*   For searches and help try:

*   For searches and help try:

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