[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: -triplot- updated on SSC |

Date |
Wed, 4 Feb 2009 19:17:47 -0000 |

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.) Nick n.j.cox@durham.ac.uk * * 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: -triplot- updated on SSC***From:*David Airey <david.airey@Vanderbilt.Edu>

- Prev by Date:
**st: table & chi-square from multiply imputed survey data (-ice-, -mim-)** - Next by Date:
**st: semi/non-parametric estimation - 'sneop' applicable to panel data?** - Previous by thread:
**st: FAQ visible on user-written ados and Stata version** - Next by thread:
**Re: st: -triplot- updated on SSC** - Index(es):

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