help wfeggraphs

Title

Graph examples

List of examples

1. Creating a graph from data in a matrix.

2. Scatterplots for all pairs of variables.

3. Adding provenance captions to a graph.

1. Creating a graph from data in a matrix

svmat stats, names(col) // use column names to name varaibles
twoway (connected bic root, msymbol(circle)), ///
ytitle(BIC statistic) ylabel(1700(10)1750) ///
xtitle(Root transformation of articles) xlabel(1(1)9) ///
caption("wf7-matrix-plot.do \ jsl 2008-04-11",size(vsmall))

2. Scatterplots for all pairs of variables

// graph matrix creates a single graph
graph matrix job phd ment art cit fem fel, ///
jitter(3) half msymbol(circle_hollow)

// the double loop creates graphs for each pair of variables
local varlist "phd job ment art cit fem fel"
local nvars : word count `varlist'
forvalues y_varnum = 1/`nvars' {
local y_var : word `y_varnum' of `varlist'
local y_lbl : variable label `y_var'
label var `y_var' "`y_var': `y_lbl'"
local x_start = `y_varnum' + 1
forvalues x_varnum = `x_start'/`nvars' {
local x_var : word `x_varnum' of `varlist'
local x_lbl : variable label `x_var'
label var `x_var' "`x_var': `x_lbl'"
scatter `y_var' `x_var', msymbol(circle_hollow) jitter(8) ///
ylabel(, grid) xlabel(, grid) aspectratio(1)
graph export wf6-review-jobphd-`y_var'-`x_var'.png, replace
label var `x_var' "`x_lbl'"
}
}

3. Adding provenance captions to graphs

local cap "wf7-caption.do \ jsl 2008-04-09"
twoway (line art_root2 art_root3 art_root4 art_root5 articles, ///
lwidth(medium)), ytitle(Number of Publications to the k-th Root) ///
yscale(range(0 8.)) legend(pos(11) rows(4) ring(0)) ///
caption(`cap', size(vsmall))

Also see

wf