[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Scatterplot: Weighted markers change size

From   Svend Juul <SJ@SOCI.AU.DK>
To   <>
Subject   Re: st: Scatterplot: Weighted markers change size
Date   Wed, 30 Jul 2008 15:46:24 +0200

Friedrich wrote:
-scatter- supports weights. When a scatterplot is drawn, all weighted
markers have a distinct size. This size changes when the data are
divided into two or more groups and then drawn as overlaid
scatterplots. I am looking for a way to retain the size of the
original markers. The problem is best understood with an example.
clear all
input x y weight group
1 1 1 1
2 1 10 1
1 2 100 2
2 2 1000 2
scatter y x [w=weight], name(A)
twoway (scatter y x if group==1 [w=weight]) ///
(scatter y x if group==2 [w=weight]), name(B)
Compare graphs A and B. In graph A all four markers have a different
size. In graph B there are two pairs of markers with the same size. I
would like to have the same marker sizes in graph B as in graph A
while keeping the colors that identify the two different groups. How
can I do this?
You can use the msize() option to modify the marker size. By trial
and error I got something close to what you want - but actually I
cannot figure out why 0.2 and 2 are the right factors:
   twoway (scatter y x if group==1 [w=weight] , msize(*0.2)) ///
   (scatter y x if group==2 [w=weight] , msize(*2)), name(C)
Hope this helps
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:   +45 8942 6090 
Phone, home:   +45 8693 7796 
Fax:           +45 8613 1580 

*   For searches and help try:

© Copyright 1996–2019 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index