I have a twoway plot involving two (or more) scatterplots. How can I make it so that the weighting (which controls the size of the dots) is universal across all scatterplots in the twoway? Currently, it seems that the weighting for a given scatterplot is relative only to itself.
This leads to some odd behavior, such as a larger dot for an observation with weight 5 than for all observations with weights higher than 5:
This leads to some odd behavior, such as a larger dot for an observation with weight 5 than for all observations with weights higher than 5:
Code:
clear all
set obs 10
gen n = _n
gen x = _n
replace x= _n - 5 if _n>5
gen group = 1
replace group = 2 if _n>5
twoway (scatter group x [aw=n] if group==1, color(blue)) ///
(scatter group x [aw=n] if group==2, color(red)), ///
legend(order(1 "Smaller weights" 2 "Larger weights"))

Comment