[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Scalling scatter plots together with by-option

From   Austin Nichols <>
Subject   Re: st: Scalling scatter plots together with by-option
Date   Wed, 10 Feb 2010 10:28:20 -0500

Jonathan Schulz <>:
You can certainly generate a variable that captures the min and max
frequencies, and you can also make your own kind of graph, where the
markers are sized in a way that is actually informative about relative
frequencies, e.g.

sysuse auto, clear
egen f=count(rep78), by(turn foreign)
sc turn rep78 [fw=f], by(foreign) name(f)
su f, mean
loc max=r(max)
g x=rep78
bys foreign turn rep78: replace x=x+(_n-1)/(`max'+1)/2
sc turn x, by(foreign) ms(S)

though the above approach requires an -expand- to sum of fweights or
something similar.  Without expanding, you could cycle over groups of
levels of fweights and make a bunch of separate overlaid scatterplots
with marker sizes set appropriately (with no fweight specified).  What
is the distribution of fweights like in your data, by group?

On Tue, Feb 9, 2010 at 1:31 PM, Jonathan Schulz
<> wrote:
> Hello,
> I want to create a scatter plot with the by-option and frequency
> weights. Is there a way to calibrate the size of the markers between the
> different graphs (so that the size of a marker with a specific weight is
> the same in all graphs)? For now the relative frequencies are only
> correct within a graph.
> Knowing how the min & max of the mark sizes are determined (within one
> graph) would allow me to adjust the weights accordingly (together with
> the msize option). Thanks a lot in advance!
> Jonathan
*   For searches and help try:

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