Statalist


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

Re: st: Scatterplot: Weighted markers change size


From   "Friedrich Huebler" <[email protected]>
To   [email protected]
Subject   Re: st: Scatterplot: Weighted markers change size
Date   Wed, 30 Jul 2008 13:42:40 -0400

Thank you, Svend. Your solution works in this particular case because
all observations in group 2 have a larger weight than the observations
in group 1. With my real data there is no such neat relationship
between the different groups. The trial and error approach to getting
the right marker sizes is also not practical with my data because I
have 200 observations in 10 groups.

Friedrich

On Wed, Jul 30, 2008 at 9:46 AM, Svend Juul <[email protected]> wrote:
> 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
*
*   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