You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A common requested task with a hexbinplot is to bins based on equal sized counts. The main issue is that there is no easy way to directly pass the number of counts to use for bins. For example, a parameter bnds = c(1, 10, 20, 30, 40, 50) would specific the count boundaries for each of the bins.
The counts are equal spaced (by 9). There is no direct was to set the sequence of counts used for the bins. The parameters we have access to are:
mincnt: Cells with fewer counts are ignored
maxcnt: Cells with more counts are ignored, defaults to auto-generation
colourcut: Vector of values covering [0, 1] that determine hexagon colour class boundaries and hexagon legend size boundaries. Alternatively, an integer (<= maxcnt) specifying the number of equispaced colourcut values in [0,1].
with some basic algebra we can compute what colorcut should set to based on what we want bnds to be
colorcut<- (bnds-mincnt) / (maxcnt-mincnt)
Another issue arises because part of the convenience of hexbinplot is that maxcnt is computed automatically. This could be done internally to avoid making a plot twice to see the maxcnt computed.
create.hexbinplot
passes most of its parameters into the functionhexbin::panel.hexbinplot
A common requested task with a hexbinplot is to bins based on equal sized counts. The main issue is that there is no easy way to directly pass the number of counts to use for bins. For example, a parameter
bnds = c(1, 10, 20, 30, 40, 50)
would specific the count boundaries for each of the bins.Take the first example from the documentation:
The counts are equal spaced (by 9). There is no direct was to set the sequence of counts used for the bins. The parameters we have access to are:
mincnt
: Cells with fewer counts are ignoredmaxcnt
: Cells with more counts are ignored, defaults to auto-generationcolourcut
: Vector of values covering [0, 1] that determine hexagon colour class boundaries and hexagon legend size boundaries. Alternatively, an integer (<= maxcnt) specifying the number of equispaced colourcut values in [0,1].In
hexbin
code there is an internal variablebnds
that is computed: https://github.com/edzer/hexbin/blob/master/R/hexbinplot.R#L557-L561with some basic algebra we can compute what
colorcut
should set to based on what we wantbnds
to beAnother issue arises because part of the convenience of
hexbinplot
is thatmaxcnt
is computed automatically. This could be done internally to avoid making a plot twice to see themaxcnt
computed.Here is a full example with "round" bins:
Created on 2023-07-07 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: