[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 |
RE: st: Problems with -triplot- |

Date |
Fri, 6 Feb 2009 13:12:00 -0000 |

Thanks to Friedrich for his comments. Fortunately, I see no real problems here. The key to understanding -separate()- is laid out tersely in the help: "separate() indicates that observations are to be subdivided into classes according to a specified variable. A legend will be shown if and only if more than one class is so defined. Each class is plotted as if it defined a single variable." Note that last sentence. To back up slightly, the one simple idea about -triplot- is that you feed it triplot p q r and it does some school student algebra (or trigonometry) to convert to that to a scatter y x together with extra bits and pieces that are of considerable cosmetic importance, but are nevertheless secondary to the logic. If you say -separate()-, -triplot- converts that (in your example) to a scatter y1 y2 x using no more than (surprise) the -separate- command. So you need to spell out scatter y1 y2 x, c(l l) mcolor(pink blue) or more precisely, triplot p q r x, c(l l) mcolor(pink blue) or whatever. Each class becomes a separate variable, and you apply standard -twoway- syntax to get the desired result. As for the -legend()-, -triplot- doesn't try to be smart about the legend but it does not have to be because you maintain full control of it. The default is indeed likely to be lousy. A better default would be legend(ring(0) pos(1) col(1)) and perhaps I should wire that in. (Note the -legend()- pops up spontaneously only if -separate()- is issued, as indicated in the help.) If you are following along, you'll see that the way to get -triplot- to superimpose multiple sets of triangular coordinates is to -stack- or -reshape- to a long data structure with a grouping variable. Friedrich's questions have given me ideas for small improvements to your code and help. Nick n.j.cox@durham.ac.uk Friedrich Huebler To clarify my question, I would like to have separate lines, one line for each country. Friedrich On Thu, Feb 5, 2009 at 4:54 PM, Friedrich Huebler <fhuebler@gmail.com> wrote: > Nick Cox recently announced an updated version of his -triplot- > package, available from SSC. I encountered some problems with the > program. > > I am trying to generate a graph similar to Figure 15 in Cox (2004), > but with data from two countries. I would like to connect the data > points for each country but when I draw the graph with the options > c(l) and separate(country), only the points from the first country are > connected. Is it possible to connect the points from the second > country, too? Can the appearance of the markers for the second country > be changed? Options like mcolor() only affect the markers for the > first country. > > There is also a problem with the legend. At the default position below > the graph, the legend partly covers the label for the lower side of > the triangle. > > Friedrich > > Reference: Cox, Nicholas J. 2004. Speaking Stata: Graphing categorical > and compositional data. Stata Journal 4, no. 2: 190-215. > http://www.stata-journal.com/article.html?article=gr0004 * * 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: Problems with -triplot-***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: Problems with -triplot-***From:*Friedrich Huebler <fhuebler@gmail.com>

**Re: st: Problems with -triplot-***From:*Friedrich Huebler <fhuebler@gmail.com>

- Prev by Date:
**RE: st: RE: which variables are in the model?** - Next by Date:
**st: linear regression with robust variance estimation** - Previous by thread:
**Re: st: Problems with -triplot-** - Next by thread:
**RE: st: Problems with -triplot-** - Index(es):

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