Statalist


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

Re: st: Scatterplot: Weighted markers change size


From   Svend Juul <[email protected]>
To   <[email protected]>
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
end
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
 
________________________________________________________ 
 
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 
E-mail:        [email protected] 
_________________________________________________________ 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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