geom_hex | ggplot examples

geom_hex | ggplot examples

Quick Start

library(ggthemes)
library(ggplot2)
library(patchwork)
world <- map_data("world")

ggplot(world, aes(long, lat)) + geom_hex() + theme_map()

Arguments

bins

ggplot(world, aes(long, lat)) + geom_hex(bins = 40) + theme_map()
P1 <-ggplot(world, aes(long, lat)) + geom_hex(bins = 20) + theme_map() + ggtitle('bins=20')
P2 <-ggplot(world, aes(long, lat)) + geom_hex(bins = 80) + theme_map() + ggtitle('bins=80')

P1|P2

NuJ1UA.png

binwidth

ggplot(world, aes(long, lat)) + geom_hex(binwidth = c(1, 10)) + theme_map()

NuJlEd.png

More

Author

Karobben

Posted on

2020-06-19

Updated on

2024-01-11

Licensed under

Comments