Skip to contents

Create a hexgrid plot

Usage

geom_hexgrid(
  mapping = NULL,
  data = NULL,
  stat = "hexgrid",
  position = "identity",
  show.legend = NA,
  na.rm = FALSE,
  inherit.aes = TRUE,
  ...
)

Arguments

mapping

Aesthetic mappings for the plot.

data

The data to be plotted.

stat

The statistical transformation to be applied.

position

The position adjustment to be applied.

show.legend

Whether to show the legend for this layer.

na.rm

Whether to remove missing values.

inherit.aes

Whether to inherit aesthetics from the plot or the layer.

...

Additional arguments to be passed to the `layer` function.

Value

A `ggplot2` layer object.

Examples

r2 <- diff(range(s_curve_noise_umap$UMAP2))/diff(range(s_curve_noise_umap$UMAP1))
num_bins_x <- 4
hb_obj <- hex_binning(data = s_curve_noise_umap_scaled, bin1 = num_bins_x,
r2 = r2)
all_centroids_df <- hb_obj$centroids
ggplot2::ggplot() +
geom_hexgrid(data = all_centroids_df, mapping = ggplot2::aes(x = c_x, y = c_y))