ggHex.Rd
This function will plot x,y coordinate values summarized in hexagons in a standardized manner
ggHex(
x = NULL,
y = NULL,
color = NULL,
pal = paletteContinuous(set = "solarExtra"),
bins = 200,
xlim = NULL,
ylim = NULL,
extend = 0.05,
xlabel = "x",
ylabel = "y",
title = "",
colorTitle = "values",
baseSize = 6,
ratioYX = 1,
FUN = "median",
hexCut = c(0.02, 0.98),
addPoints = FALSE,
...
)
A numeric vector containing the x-axis values for each point.
A numeric vector containing the y-axis values for each point.
A numeric/categorical vector containing coloring information for each point.
A custom continuous palette from ArchRPalettes
for coloration of hexes.
The number of bins to be used for plotting the hexplot. bins
indicates the total number of hexagons that will fit within the surface area of the plot.
A numeric vector of two values indicating the lower and upper bounds of the x-axis on the plot.
A numeric vector of two values indicating the lower and upper bounds of the y-axis on the plot.
A numeric value indicating the fraction to extend the x-axis and y-axis beyond the maximum and minimum values if xlim
and ylim
are not provided. For example, 0.05 will extend the x-axis and y-axis by 5 percent on each end.
The label to plot for the x-axis.
The label to plot for the y-axis.
The title of the plot.
The label to use for the legend corresponding to color
.
The base font size (in points) to use in the plot.
The aspect ratio of the x and y axes on the plot.
The function to use for summarizing data into hexagons. Typically "mean" or something similar.
If this is not null, a quantile cut is performed to threshold the top and bottom of the distribution of values.
This prevents skewed color scales caused by strong outliers. The format of this should be c(a,b) where a
is the upper threshold
and b
is the lower threshold. For example, hexCut = c(0.025,0.975) will take the top and bottom 2.5 percent of values and set
them to the value of the 97.5th and 2.5th percentile values respectively.
A boolean value indicating whether individual points should be shown on the hexplot.
Additional params for plotting
# Create Random Data
m <- data.frame(matrix(rnorm(300, 2),ncol=3))
# Plot
p <- ggHex(x = m[,1], y = m[,2], color = m[,3])
# To PDF
pdf("test.pdf", width = 4, height = 4)
p
dev.off()