Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • addplot available from SSC

    Thanks to Kit Baum, a new package called addplot is available from SSC. Stata 9 is required.

    addplot adds twoway plot objects to an existing twoway graph. This is useful if you want to add additional objects such as titles or extra data points to a twoway graph after it has been created. Most of what addplot can do, can also be done by rerunning the original graph command including additional options or plot statements. addplot, however, might be useful if you have to modify a graph for which you cannot rerun the original command, for example, because you only have the graph file but not the data that were used to create the graph. Furthermore, addplot can do certain things that would be difficult to achieve in a single graph command (e.g. customizing individual subgraphs within a by-graph). addplot also provides a substitute for some of the functionality of the graph editor.

    Here's an example where individual reference lines are added to the subgraphs of a by-graph:
    Code:
    sysuse auto
    scatter mpg turn, by(foreign) jitter(2) msymbol(Oh)
    summarize mpg if foreign==0, meanonly
    addplot 1: , yline(`r(mean)') norescaling
    summarize mpg if foreign==1, meanonly
    addplot 2: , yline(`r(mean)') norescaling
    summarize mpg, meanonly
    addplot: , yline(`r(mean)', lpattern(dash)) norescaling
    Click image for larger version

Name:	example.png
Views:	1
Size:	64.2 KB
ID:	273559
    ben

  • #2
    Very useful. Thanks.

    Fred

    Comment

    Working...
    X