..- help for ^loopplot^ ..- Scatter plots with loops - ------------------------ ^loopplot^ varlist [weight] [^if^ exp] [^in^ range] [^,^ graph_options] Description - ----------- ^loopplot^ produces a scatter or twoway plot for varlist, in which ^connect(l)^ has the effect of producing a loop: the last data point is joined to the first. This is achieved by temporarily appending one or more extra observations to the data set that copy the first relevant non-missing observation for each loop. Options - ------- graph_options are options allowed with ^graph, twoway^, including ^by()^. ^sort^ is allowed but ignored. Remarks - ------- There are some known side-effects of appending extra observations: ^sy([_n])^ is marred by overwriting of ^_n^ for the first observation and its copy. The correct effect can be achieved by . ^gen id = _n^ . ^loopplot y x, c(l) sy([id])^ There are various small or large effects on other ^connect^ options. Suppose there are several variables to be plotted on the y axis. Each variable should define just one loop. (If any variable specifies more than one loop, there would be spurious connections between them.) Suppose we have four loops defined by ^y1^ and ^x1^ ^y2^ and ^x2^ ^y3^ and ^x3^ ^y4^ and ^x4^ then to meet the Stata rule that only one variable can be plotted on the x axis it is necessary to pack the four x variables into one. A satisfactory data structure to start with is ^y1 . . . x1^ ^. y2 . . x2^ ^. . y3 . x3^ ^. . . y4 x4^ stacked into ^Y1 Y2 Y3 Y4 X^ Here the ^.^ represent blocks of missing values. This data structure could be produced by using ^stack^, or by direct entry of the data. Examples - -------- . ^loopplot rain temp, c(l)^ . ^loopplot rain temp, c(l) by(station)^ Author - ------ Nicholas J. Cox, University of Durham, U.K. n.j.cox@@durham.ac.uk Also see - -------- On-line: help for @graph@