help sunflower dialog: sunflower
-------------------------------------------------------------------------------
Title
[R] sunflower -- Density-distribution sunflower plots
Syntax
sunflower yvar xvar [if] [in] [weight] [, options]
options description
-------------------------------------------------------------------------
Main
nograph do not show graph
notable do not show summary table; implied when
by() is specified
marker_options affect rendition markers plotting
points
Bins/Petals
binwidth(#) width of the hexagonal bins
binar(#) aspect ratio of the hexagonal bins
bin_options affect rendition of hexagonal bins
light(#) minimum observations for a light
sunflower; default is light(3)
dark(#) minimum observations for a dark
sunflower; default is dark(13)
xcenter(#) x-coordinate of the reference bin
ycenter(#) y-coordinate of the reference bin
petalweight(#) observations in a dark sunflower petal
petallength(#) length of sunflower petal as a
percentage
petal_options affect rendition of sunflower petals
flowersonly show petals only; do not render bins
nosinglepetal suppress single petals
Add plots
addplot(plot) add other plots to generated graph
Y axis, X axis, Titles, Legend, Overall, By
twoway_options any options documented in
[G] twoway_options
-------------------------------------------------------------------------
bin_options description
-------------------------------------------------------------------------
[l|d]bstyle(areastyle) overall look of hexagonal bins
[l|d]bcolor(colorstyle) outline and fill color
[l|d]bfcolor(colorstyle) fill color
[l|d]blstyle(linestyle) overall look of outline
[l|d]blcolor(colorstyle) outline color
[l|d]blwidth(linewidthstyle) thickness of outline
-------------------------------------------------------------------------
petal_options description
-------------------------------------------------------------------------
[l|d]flstyle(linestyle) overall style of sunflower petals
[l|d]flcolor(colorstyle) color of sunflower petals
[l|d]flwidth(linewidthstyle) thickness of sunflower petals
-------------------------------------------------------------------------
All options are rightmost; see repeated_options.
fweights are allowed; see weight.
Menu
Graphics > Smoothing and densities > Density-distribution sunflower plot
Description
sunflower draws density-distribution sunflower plots (Dupont and Plummer
2003). These plots are useful for displaying bivariate data whose
density is too great for conventional scatterplots to be effective.
A sunflower is several line segments of equal length, called petals, that
radiate from a central point. There are two varieties of sunflowers:
light and dark. Each petal of a light sunflower represents 1
observation. Each petal of a dark sunflower represents several
observations. Dark and light sunflowers represent high- and
medium-density regions of the data, and marker symbols represent
individual observations in low-density regions.
The plane defined by the variables yvar and xvar is divided into
contiguous hexagonal bins. The number of observations contained within a
bin determines how the bin will be represented.
o When there are fewer than light(#) observations in a bin, each point is
plotted using the usual marker symbols in a scatterplot.
o Bins with at least light(#) but fewer than dark(#) observations are
represented by a light sunflower.
o Bins with at least dark(#) observations are represented by a dark
sunflower.
Options
+------+
----+ Main +-------------------------------------------------------------
nograph prevents the graph from being generated.
notable prevents the summary table from being displayed. This option is
implied when the by() option is specified.
marker_options affect the rendition of markers drawn at the plotted
points, including their shape, size, color, and outline; see [G]
marker_options.
+-------------+
----+ Bins/Petals +------------------------------------------------------
binwidth(#) specifies the horizontal width of the hexagonal bins in the
same units as xvar. By default,
binwidth = max(rbw,nbw)
where
rbw = range of xvar/40
nbw = range of xvar/max(1,nb)
and
nb = int(min(sqrt(n),10*log10(n)))
where
n = the number of observations in the dataset
binar(#) specifies the aspect ratio for the hexagonal bins. The height
of the bins is given by
binheight = binwidth * # * 2/sqrt(3)
where binheight and binwidth are specified in the units of yvar and
xvar, respectively. The default is binar(r), where r results in the
rendering of regular hexagons.
bin_options affect how the hexagonal bins are rendered.
lbstyle(areastyle) and dbstyle(areastyle) specify the look of the
light and dark hexagonal bins, respectively. The options listed
below allow you to change each attribute, but lbstyle() and
dbstyle() provide the starting points. See [G] areastyle for a
list of available area styles.
lbcolor(colorstyle) and dbcolor(colorstyle) specify one color to be
used both to outline the shape and to fill the interior of the
light and dark hexagonal bins, respectively. See [G] colorstyle
for a list of color choices.
lbfcolor(colorstyle) and dbfcolor(colorstyle) specify the color to be
used to fill the interior of the light and dark hexagonal bins,
respectively. See [G] colorstyle for a list of color choices.
lblstyle(linestyle) and dblstyle(linestyle) specify the overall style
of the line used to outline the area, which includes its pattern
(solid, dashed, etc.), thickness, and color. The other options
listed below allow you to change the line's attributes, but
lblstyle() and dblstyle() are the starting points. See [G]
linestyle for a list of choices.
lblcolor(colorstyle) and dblcolor(colorstyle) specify the color to be
used to outline the light and dark hexagonal bins, respectively.
See [G] colorstyle for a list of color choices.
lblwidth(linewidthstyle) and dblwidth(linewidthstyle) specify the
thickness of the line to be used to outline the light and dark
hexagonal bins, respectively. See [G] linewidthstyle for a list
of choices.
light(#) specifies the minimum number of observations needed for a bin to
be represented by a light sunflower. The default is light(3).
dark(#) specifies the minimum number of observations needed for a bin to
be represented by a dark sunflower. The default is dark(13).
xcenter(#) and ycenter(#) specify the center of the reference bin. The
default values are the median values of xvar and yvar, respectively.
The centers of the other bins are implicitly defined by the location
of the reference bin together with the common bin width and height.
petalweight(#) specifies the number of observations represented by each
petal of a dark sunflower. The default value is chosen so that the
maximum number of petals on a dark sunflower is 14.
petallength(#) specifies the length of petals in the sunflowers. The
value specified is interpreted as a percentage of half the bin width.
The default is 100%.
petal_options affect how the sunflower petals are rendered.
lflstyle(linestyle) and dflstyle(linestyle) specify the overall style
of the light and dark sunflower petals, respectively.
lflcolor(colorstyle) and dflcolor(colorstyle) specify the color of
the light and dark sunflower petals, respectively.
lflwidth(linewidthstyle) and dflwidth(linewidthstyle) specify the
width of the light and dark sunflower petals, respectively.
flowersonly suppresses rendering of the bins. This option is equivalent
to specifying lbcolor(none) and dbcolor(none).
nosinglepetal suppresses flowers from being drawn in light bins that
contain only 1 observation and dark bins that contain as many
observations as the petal weight (see the petalweight() option).
+-----------+
----+ Add plots +--------------------------------------------------------
addplot(plot) provides a way to add other plots to the generated graph;
see [G] addplot_option.
+---------------------------------------------+
----+ Y axis, X axis, Titles, Legend, Overall, By +----------------------
twoway_options are any of the options documented in [G] twoway_options.
These include options for titling the graph (see [G] title_options),
options for saving the graph to disk (see [G] saving_option), and the
by() option (see [G] by_option).
Examples
. sysuse auto
. sunflower mpg displ
(click to run)
. sunflower mpg displ, xcenter(100) ycenter(100) binwidth(20)
(click to run)
. sunflower mpg weight, binwidth(500) petalweight(2) dark(8)
(click to run)
Reference
Dupont, W. D., and W. D. Plummer Jr. 2003. Density distribution sunflower
plots. Journal of Statistical Software 8: 1-11.
Also see
Manual: [R] sunflower