library(ggplot2)
ggplot(diamonds) +
aes(x = clarity, fill = cut) +
geom_diverging()
ggplot(diamonds) +
aes(x = clarity, fill = cut) +
geom_diverging(position = position_diverging(cutoff = 4))
ggplot(diamonds) +
aes(y = clarity, fill = cut) +
geom_likert() +
geom_likert_text()
ggplot(diamonds) +
aes(y = clarity, fill = cut) +
geom_likert() +
geom_likert_text(
aes(
label = label_percent_abs(accuracy = 1, hide_below = .10)(
after_stat(prop)
),
colour = after_scale(hex_bw(.data$fill))
)
)
d <- Titanic |> as.data.frame()
ggplot(d) +
aes(y = Class, fill = Sex, weight = Freq) +
geom_diverging() +
geom_diverging_text()
ggplot(d) +
aes(y = Class, fill = Sex, weight = Freq) +
geom_pyramid() +
geom_pyramid_text()
Run the code above in your browser using DataLab