data(olives)
x <- olives$oleic
y <- olives$linoleic
z <- olives$Region
# the default
hexpie(x, y, z)
# zooming in (transformation of the total number of obs in each bin)
hexpie(x, y, z, freq.trans = sqrt)
# circular shapes
hexpie(x, y, z, freq.trans = sqrt, shape = "pie")
# classical piecharts
hexpie(x, y, z, freq.trans = sqrt, shape = "pie", p.rule = "angles")
# the total numbers of obs are reflected via alpha-blending,
the grid is not shown and RGB colors are used
hexpie(x, y, z, freq.trans = sqrt, shape = "hex", p.rule = "radial", alpha.freq = TRUE,
col = "rgb", show.hex = FALSE)
# no transformation, grid shown
hexpie(x, y, z, freq.trans = NULL, shape = "hex", p.rule = "radial", alpha.freq = TRUE,
col = "rgb", show.hex = TRUE)
# diamonds data
require(ggplot2)
data(diamonds)
x2 <- diamonds$carat
y2 <- diamonds$price
z2 <- diamonds$color
# a standard plot with colors via ggplot2
qplot(x2, y2, colour = z2)
# the hexpie version
hexpie(x2, y2, z2, n = 36)
# zooming in via log-transformation
hexpie(x2, y2, z2, n = 36, freq.trans = function(s) log(1 + s))
# the same, but this time the central color is the most frequent one
hexpie(x2, y2, z2, n = 36, freq.trans = function(s) log(1 + s), decr.by.rank = TRUE)
# this way the difference is more obvious
(the color palette is better suited for ordinal target variables)
hexpie(x2, y2, z2, n = 18, freq.trans = NULL, decr.by.rank = NULL, col = "div")
hexpie(x2, y2, z2, n = 18, freq.trans = NULL, decr.by.rank = T, col = "div")
# random samples from the data (within bins) with many bins
(takes some time)
hexpie(x2, y2, z2, freq.trans = function(s) log(1 + s), random = 1, n = 120,
show.hex = FALSE, col.opt = list(bg = "black"))