Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions binscatter.ado
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,9 @@ program define binscatter, eclass sortpreserve
local byvalname `: label `bylabel' `byval''
}

if (`ynum'==1) local legend_labels `legend_labels' lab(`counter_series' `byvarname'=`byvalname')
else local legend_labels `legend_labels' lab(`counter_series' `depvar': `byvarname'=`byvalname')
if (`ynum'==1) local legend_labels `legend_labels' lab(`counter_series' `byvalname')
else local legend_labels `legend_labels' lab(`counter_series' `depvar': `byvalname')
local bylegendtitle legend(subtitle("`byvarname'"))
}
if ("`by'"!="" | `ynum'>1) local order `order' `counter_series'

Expand Down Expand Up @@ -655,7 +656,7 @@ program define binscatter, eclass sortpreserve
else local ytitle : subinstr local y_vars " " "; ", all

* Display graph
local graphcmd twoway `scatters' `fits', graphregion(fcolor(white)) `xlines' xtitle(`x_var') ytitle(`ytitle') legend(`legend_labels' order(`order')) `options'
local graphcmd twoway `scatters' `fits', graphregion(fcolor(white)) `xlines' xtitle(`x_var') ytitle(`ytitle') legend(`legend_labels' order(`order')) `bylegendtitle' `options'
if ("`savedata'"!="") local savedata_graphcmd twoway `savedata_scatters' `fits', graphregion(fcolor(white)) `xlines' xtitle(`x_var') ytitle(`ytitle') legend(`legend_labels' order(`order')) `options'
`graphcmd'

Expand Down