This package is an extension to ggplot2 to enable faster design exploration for data visualisation.
For now, it contains the custom geom_dash that allows plotting dashes instead of points. Those can be rotated (aes_angle in radiant) or widden (aes_width) to encode additional informations in comparison of geom_points.
It also allows distribution visualisation like geom_rug.
iris %>% ggplot(aes(Species , Petal.Length)) +
geom_dash(width = 0.8) +
coord_fixed()
An example of the use of geom_dash
to plot gradients/fields is as
follow:
library(data.table)
library(metR) # devtools::install_github("eliocamp/metR")
volcano <- as.data.table(melt(volcano, varnames = c("x", "y"),
value.name = "h"))
volcano[, c("dx", "dy") := metR::Derivate(h ~ x + y)]
volcano[, "angle" := atan(dy/dx)]
volcano[, "slope" := sqrt(dy^2 + dx^2)]
volcano %>% as.data.frame() %>% ggplot(aes(x, y)) +
geom_dash(aes(width = slope/max(slope, na.rm = T), angle = angle), relative = T) +
coord_fixed()+ theme_void()
## Warning: Removed 586 rows containing missing values (geom_dash).
The geom_arc function allows rapic arc visualisation:
iris %>% ggplot(aes(Sepal.Length , Petal.Length, colour = Species)) +
geom_arc(width = 0.8, aes(angle = Petal.Width ,radius = 0.1*Sepal.Width)) +
coord_fixed()
Because these geoms do not use symbols, but explicit representation of
geometric objects, they work better with fixed coordinates. Without
fixed coordinates of the plot, the distortion between the axes is
propagated to the geometric objects. This can be ensured by addig
+ coord_fixed()
to your ggplot call.
Further work is needed to ensure all objects fit the frame of the plot
that is currently computed from the x,y of the aesthetic, and not the
generated geometric objects. For now this problem is fixed by increasin
the visible area with the function coord_cartesian()
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.