The latest update of dstat now provides command twoway dstat that makes it possible to include dstat's distribution estimates (PDF, CDF, complementary CDF, histogram, proportions, quantiles, Lorenz curves, percentile shares, TIP curves) in two-way graphs. There are two syntax variants. Under syntax one, results are computed on the fly; syntax two can be used to plot existing estimates; the two syntax types can be combined in a single twoway command. For example, here is how you could print a histogram including error bars and overlay a kernel density estimate.
Compute all results on the fly (syntax 1)
Compute some results upfront and some on the fly (mix of syntax 1 and 2; "." selects the current/active estimates)
Compute all results upfront (syntax 2)
All three examples produce the same graph, which looks about as follows.

Specifying multiple variables or sub-populations is supported:


Type
to install the update. After that, type
for documentation. Stata version 16 or newer is required by twoway dstat.
Compute all results on the fly (syntax 1)
Code:
sysuse nlsw88, clear
twoway (dstat histogram tenure, ep n(sturges) lalign(center)) ///
(dstat ci histogram tenure, ep n(sturges)) ///
(dstat pdf tenure, ll(0) pstyle(p2))
Code:
dstat histogram tenure, ep n(sturges)
twoway (dstat ., lalign(center)) ///
(dstat ci .) ///
(dstat pdf tenure, ll(0) pstyle(p2))
Code:
dstat histogram tenure, ep n(sturges)
estimates store HIST
dstat pdf tenure, ll(0)
estimates store PDF
twoway (dstat HIST, lalign(center)) ///
(dstat ci HIST) ///
(dstat PDF, pstyle(p2))
Specifying multiple variables or sub-populations is supported:
Code:
twoway (dstat ci pdf tenure ttl_exp wage, ll(0)) ///
(dstat pdf tenure ttl_exp wage, ll(0) pstyle(p1 p2 p3) ///
lpattern(l dash dash_dot) lwidth(medthick ..))
Code:
twoway dstat pdf tenure ttl_exp wage, ll(0) over(union)
Type
Code:
. ssc install dstat, replace
Code:
. help twoway dstat
