Powered by AppSignal & Oban Pro

The identity stat: stat_identity

notebooks/stat_identity.livemd

The identity stat: stat_identity

Mix.install([
  {:giggly, path: Path.join(__DIR__, "..")},
  {:kino, "~> 0.19"}
  ])

About this notebook

This notebook follows the examples on ggplot2's reference page for stat_identity(), in the order the page gives them. Each example shows ggplot2's code first and then Giggly's. An example Giggly cannot draw yet keeps its ggplot2 code and names what it is waiting for, so the page is also a list of what remains.

The identity stat leaves the data unchanged, so each row is drawn where its mapping puts it. It is the stat of most geoms, geom_point() and geom_col() among them; as a layer of its own, stat_identity() draws points unless another geom is given. Giggly has no stat_identity(), but its Giggly.Plot.geom_point/3 and Giggly.Plot.geom_col/3 are ggplot2's geom_point() and geom_col(), which use it.

Points, unchanged

p <- ggplot(mtcars, aes(wt, mpg))
p + stat_identity()

Not in Giggly yet: stat_identity(). With its default geom, this is the scatter plot that geom_point() draws from the same mapping, which Giggly.Plot.geom_point/3 draws too.