Hi, Nick, I will do that next time.
HTML Code:
I found this at <reference> (original in Chinese).
*! version 1.1 (14Nov02) pbe program define histbox version 7.0 syntax varlist(max=1) [if] [in] [fweight] [, Mean by(string) * ] if `"`by'"' != "" { window manage forward results display as err "by option not allowed" exit 198 } tokenize `varlist' gph open capture graph `1' `if' `in' [`weight' `exp'], hist bbox(600,0,23063,32000,850,390,0) `options' if _rc>0 { window manage forward results display as help "r(198)" exit } local ay = r(ay) local by = r(by) local ax = r(ax) local bx = r(bx) local r1 = 50 local r2 = 600 local rc = (`r2'-`r1')/2+`r1' quietly summarize `1' `if' `in' [`weight' `exp'], detail local q1 = r(p25) local q2 = r(p50) local q3 = r(p75) local qm = r(mean) local ql = r(min) local qu = r(max) local cl = `ax'*`ql'+`bx' local c1 = `ax'*`q1'+`bx' local c2 = `ax'*`q2'+`bx' local c3 = `ax'*`q3'+`bx' local cu = `ax'*`qu'+`bx' local cm = `ax'*`qm'+`bx' gph pen 2 gph line `r1' `c1' `r1' `c3' gph line `r2' `c1' `r2' `c3' gph line `r1' `cl' `r2' `cl' gph line `r1' `c1' `r2' `c1' gph line `r1' `c2' `r2' `c2' gph line `r1' `c3' `r2' `c3' gph line `r1' `cu' `r2' `cu' gph line `rc' `cl' `rc' `c1' gph line `rc' `c3' `rc' `cu' if "`mean'"~="" { gph pen 3 gph point `rc' `cm' 0 6 } gph close window manage forward graph end
ssc install grinset, replace h grinset
* Load the example dta file: sysuse nlsw88, clear * Create the main plot tw scatter wage hours, graphreg(fc(white) lc(white) ilc(white) m(r+10 t+10)) plotreg(m(none) lc(none)) ylab(, nogextend) xlab(, nogextend) ysca(noex) * Create the first inset (i.e. graph box) & next adjust its location and size as to position it at the right side of the main plot grinset t=3.5 r=2: graph box wage, scale(1) plotreg(m(none) lc(none)) ysca(off) grinset t=13.5 r=2, size(74 5) scale(1) * Create the second inset (i.e. graph hbox) & next adjust its location and size as to position it at the top side of the main plot grinset t=5 l=13: graph hbox hours, scale(1) plotreg(m(none) lc(none)) ysca(off) grinset t=2.7 l=13, size(8.3 84) scale(1)
Comment