Skip to content

Support violin plot and probability density plots #3442

@kanitw

Description

@kanitw

From https://vega.github.io/vega/examples/violin-plot/

A violin plot visualizes a distribution of quantitative values as a continuous approximation of the probability density function, computed using kernel density estimation (KDE). The densities are additionally annotated with the median value and interquartile range, shown as black lines. Violin plots can be more informative than classical box plots.

https://vega.github.io/vega/examples/probability-density/ is another related example

  • Understand https://vega.github.io/vega/examples/violin-plot/ and https://vega.github.io/vega/examples/probability-density/ examples throughly, search online to understand other violin and density plot variants, and define the scope that we want to support.

  • Understand how we implement composite mark thoroughly by looking at the [box-plot codebase](https://github.com/vega/vega-lite/blob/master/src/compositemark/boxplot.ts. (By summer, we should have reasonable error-bar example as well.)

  • Design density transform in Vega-Lite and see if we can already use area mark to reproduce the density area for violin.

  • Design composite mark syntax for violin (and density plot?)

    • First we can focus on just the violin area part: design MarkDefinition block for Violin so that we can define property of the underlying density transform and other related properties
    • Decide if we need a composite mark for density plot -- (probably yes), and make sure that the syntax for violin and density are consistent. (Also think if there is a better name for density too)
    • For violin plot, we need to decide if we want to include interquartile range and median as a part of the violin composite mark (which is sort of like the "box" overlay on top of violin plot). The syntax here should be very consistent with box-plot.
  • Implement the code. Note that there is probably a good way to share at least some part of the implementation between the violin and density plot.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Statistical visualization

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions