help hexplothttp://github.com/benjann/heatplot/

Title

hexplot -- Command to create hexagon plots

Syntax

Syntax 1: Hex plot from variables

hexplot [z] y x [if] [in] [weight]
[,
options
]

where z is a numeric variable (assumed constant if omitted), y
is a numeric variable or a string variable, and x is a numeric variable
or a string variable. Categorical y and x variables can be specified
as i.varname.

Syntax 2: Hex plot from Mata matrix

hexplot mata(name)
[,
options
]

where name is a numeric Mata matrix (contents = z, row index = y,
column index = x).

Syntax 3: Hex plot from Stata matrix

hexplot matname [,
options
]

where matname is a Stata matrix
(contents = z, row names = y, column names = x).

options

horizontal arrange hexagons horizontally

left start with a left shift

odd use odd number of columns

heatplot_options Syntax 1, Syntax 2, or
Syntax 3 options of heatplot

fweights, aweights, iweights, and pweights are allowed with Syntax 1; see help weight.

Description

hexplot creates hexagon plots. It is implemented as a wrapper for
heatplot. hexplot is equivalent to heatplot with option
hexagon.

Options

horizontal arranges the hexagons horizontally. The default is to arrange
the hexagons vertically.

left starts with a left-shifted hexagon row. The default is to start
with a right-shifted row. If horizontal is specified, left
starts with an down-shifted row instead of an up-shifted row.

odd uses an odd number of hexagon columns. The default is to use
an even number of columns. That is, by default the bins on the x-axis are
constructed in a way such that each bin contains a double column of hexagons,
yielding an even overall number of columns. Specify odd to construct the
bins in a way such that the last bin only contains a single column. If
horizontal is specified, odd affects the number of
hexagon rows rather than columns.

heatplot_options are heatplot options allowed in Syntax 1, 2, or
3, respectively. Not allowed are options scatter(), hexagon(),
bcuts(), ybcuts(), and xbcuts().

Examples

. drawnorm y x, n(10000) corr(1 .5 1) cstorage(lower) clear
. hexplot y x
. hexplot y x, horizontal
. hexplot y x, size recenter

. hexplot y x, statistic(count) cuts(@min(5)@max) colors(dimgray black) keylabels(, range(1))

. sysuse auto, clear

. hexplot price weight mpg, colors(plasma, intensity(.6)) p(lc(black) lalign(center)) legend(off) values(format(%9.0f)) aspectratio(1)

Author

Ben Jann, University of Bern, ben.jann@unibe.ch

Thanks for citing this software as follows:

Jann, B. (2019). heatplot: Stata module to create heat plots and hexagon plots. Available from
http://ideas.repec.org/c/boc/bocode/s458595.html.

Also see

Online: help for heatplot, colorpalette,
twoway contour