Skip to content

What is Plot?

Observable Plot is a free, open-source, JavaScript library for visualizing tabular data, focused on accelerating exploratory data analysis. It has a concise, memorable, yet expressive interface, featuring scales and layered marks in the grammar of graphics style popularized by Leland Wilkinson and Hadley Wickham and inspired by the earlier ideas of Jacques Bertin. And there are plenty of examples to learn from and copy-paste.

In the spirit of show don’t tell, here’s a scatterplot of body measurements of athletes from the 2016 Summer Olympics.

Fork
js
Plot
  .dot(olympians, {x: "weight", y: "height", stroke: "sex"})
  .plot({color: {legend: true}})

A plot specification assigns columns of data (weight, height, and sex) to visual properties of marks (x, y, and stroke). Plot does the rest! You can configure much more, if needed, but Plot’s goal is to help you get a meaningful visualization quickly to accelerate analysis.

This scatterplot suffers from overplotting: many dots are drawn in the same spot, so it’s hard to perceive density. We can fix this by applying a bin transform to group athletes of similar height and weight (and sex), and then use opacity to encode the number of athletes in the bin.

Fork
js
Plot.rect(olympians, Plot.bin({fillOpacity: "count"}, {x: "weight", y: "height", fill: "sex", inset: 0})).plot()

Or we could try the density mark.

Fork
js
Plot.density(olympians, {x: "weight", y: "height", stroke: "sex"}).plot()

A simpler take on this data is to focus on one dimension: weight. We can use the bin transform again to make a histogram with weight on the x-axis and frequency on the y-axis. This plot uses a rect mark and an implicit stack transform.

Fork
js
Plot.rectY(olympians, Plot.binX({y: "count"}, {x: "weight", fill: "sex"})).plot()

Or if we’d prefer to show the two distributions separately as small multiples, we can facet the data along y (keeping the fill encoding for consistency, and adding grid lines and a rule at y = 0 to improve readability).

Fork
js
Plot.plot({
  grid: true,
  marks: [
    Plot.rectY(olympians, Plot.binX({y: "count"}, {x: "weight", fill: "sex", fy: "sex"})),
    Plot.ruleY([0])
  ]
})

What can Plot do?

Because marks are composable, and because you can extend Plot with custom marks, you can make almost anything with it — much more than the charts above! The following tree diagram of the documentation gives a sense of what’s ”in the box” with Plot. Peruse our gallery of examples for more inspiration.

/Plot/Plot/Introduction/Plot/Features/Plot/Marks/Plot/Transforms/Plot/Interactions/Plot/API index/Plot/API index/Plot/Introduction/What is Plot?/Plot/Introduction/What is Plot?/Plot/Introduction/Why Plot?/Plot/Introduction/Why Plot?/Plot/Introduction/Getting started/Plot/Introduction/Getting started/Plot/Introduction/Examples/Plot/Introduction/Examples/Plot/Features/Plots/Plot/Features/Plots/Plot/Features/Marks/Plot/Features/Marks/Plot/Features/Scales/Plot/Features/Scales/Plot/Features/Projections/Plot/Features/Projections/Plot/Features/Transforms/Plot/Features/Transforms/Plot/Features/Interactions/Plot/Features/Interactions/Plot/Features/Facets/Plot/Features/Facets/Plot/Features/Legends/Plot/Features/Legends/Plot/Features/Curves/Plot/Features/Curves/Plot/Features/Formats/Plot/Features/Formats/Plot/Features/Intervals/Plot/Features/Intervals/Plot/Features/Markers/Plot/Features/Markers/Plot/Features/Shorthand/Plot/Features/Shorthand/Plot/Features/Accessibility/Plot/Features/Accessibility/Plot/Marks/Area/Plot/Marks/Area/Plot/Marks/Arrow/Plot/Marks/Arrow/Plot/Marks/Auto/Plot/Marks/Auto/Plot/Marks/Axis/Plot/Marks/Axis/Plot/Marks/Bar/Plot/Marks/Bar/Plot/Marks/Bollinger/Plot/Marks/Bollinger/Plot/Marks/Box/Plot/Marks/Box/Plot/Marks/Cell/Plot/Marks/Cell/Plot/Marks/Contour/Plot/Marks/Contour/Plot/Marks/Delaunay/Plot/Marks/Delaunay/Plot/Marks/Density/Plot/Marks/Density/Plot/Marks/Difference/Plot/Marks/Difference/Plot/Marks/Dot/Plot/Marks/Dot/Plot/Marks/Frame/Plot/Marks/Frame/Plot/Marks/Geo/Plot/Marks/Geo/Plot/Marks/Grid/Plot/Marks/Grid/Plot/Marks/Hexgrid/Plot/Marks/Hexgrid/Plot/Marks/Image/Plot/Marks/Image/Plot/Marks/Line/Plot/Marks/Line/Plot/Marks/Linear regression/Plot/Marks/Linear regression/Plot/Marks/Link/Plot/Marks/Link/Plot/Marks/Raster/Plot/Marks/Raster/Plot/Marks/Rect/Plot/Marks/Rect/Plot/Marks/Rule/Plot/Marks/Rule/Plot/Marks/Text/Plot/Marks/Text/Plot/Marks/Tick/Plot/Marks/Tick/Plot/Marks/Tip/Plot/Marks/Tip/Plot/Marks/Tree/Plot/Marks/Tree/Plot/Marks/Vector/Plot/Marks/Vector/Plot/Marks/Waffle/Plot/Marks/Waffle/Plot/Transforms/Bin/Plot/Transforms/Bin/Plot/Transforms/Centroid/Plot/Transforms/Centroid/Plot/Transforms/Dodge/Plot/Transforms/Dodge/Plot/Transforms/Filter/Plot/Transforms/Filter/Plot/Transforms/Group/Plot/Transforms/Group/Plot/Transforms/Hexbin/Plot/Transforms/Hexbin/Plot/Transforms/Interval/Plot/Transforms/Interval/Plot/Transforms/Map/Plot/Transforms/Map/Plot/Transforms/Normalize/Plot/Transforms/Normalize/Plot/Transforms/Select/Plot/Transforms/Select/Plot/Transforms/Shift/Plot/Transforms/Shift/Plot/Transforms/Sort/Plot/Transforms/Sort/Plot/Transforms/Stack/Plot/Transforms/Stack/Plot/Transforms/Tree/Plot/Transforms/Tree/Plot/Transforms/Window/Plot/Transforms/Window/Plot/Interactions/Crosshair/Plot/Interactions/Crosshair/Plot/Interactions/Pointer/Plot/Interactions/PointerAPI index/Plot/API indexAPI index/Plot/API indexWhat is Plot?/Plot/Introduction/What is Plot?What is Plot?/Plot/Introduction/What is Plot?Why Plot?/Plot/Introduction/Why Plot?Why Plot?/Plot/Introduction/Why Plot?Getting started/Plot/Introduction/Getting startedGetting started/Plot/Introduction/Getting startedExamples/Plot/Introduction/ExamplesExamples/Plot/Introduction/ExamplesPlots/Plot/Features/PlotsPlots/Plot/Features/PlotsMarks/Plot/Features/MarksMarks/Plot/Features/MarksScales/Plot/Features/ScalesScales/Plot/Features/ScalesProjections/Plot/Features/ProjectionsProjections/Plot/Features/ProjectionsTransforms/Plot/Features/TransformsTransforms/Plot/Features/TransformsInteractions/Plot/Features/InteractionsInteractions/Plot/Features/InteractionsFacets/Plot/Features/FacetsFacets/Plot/Features/FacetsLegends/Plot/Features/LegendsLegends/Plot/Features/LegendsCurves/Plot/Features/CurvesCurves/Plot/Features/CurvesFormats/Plot/Features/FormatsFormats/Plot/Features/FormatsIntervals/Plot/Features/IntervalsIntervals/Plot/Features/IntervalsMarkers/Plot/Features/MarkersMarkers/Plot/Features/MarkersShorthand/Plot/Features/ShorthandShorthand/Plot/Features/ShorthandAccessibility/Plot/Features/AccessibilityAccessibility/Plot/Features/AccessibilityArea/Plot/Marks/AreaArea/Plot/Marks/AreaArrow/Plot/Marks/ArrowArrow/Plot/Marks/ArrowAuto/Plot/Marks/AutoAuto/Plot/Marks/AutoAxis/Plot/Marks/AxisAxis/Plot/Marks/AxisBar/Plot/Marks/BarBar/Plot/Marks/BarBollinger/Plot/Marks/BollingerBollinger/Plot/Marks/BollingerBox/Plot/Marks/BoxBox/Plot/Marks/BoxCell/Plot/Marks/CellCell/Plot/Marks/CellContour/Plot/Marks/ContourContour/Plot/Marks/ContourDelaunay/Plot/Marks/DelaunayDelaunay/Plot/Marks/DelaunayDensity/Plot/Marks/DensityDensity/Plot/Marks/DensityDifference/Plot/Marks/DifferenceDifference/Plot/Marks/DifferenceDot/Plot/Marks/DotDot/Plot/Marks/DotFrame/Plot/Marks/FrameFrame/Plot/Marks/FrameGeo/Plot/Marks/GeoGeo/Plot/Marks/GeoGrid/Plot/Marks/GridGrid/Plot/Marks/GridHexgrid/Plot/Marks/HexgridHexgrid/Plot/Marks/HexgridImage/Plot/Marks/ImageImage/Plot/Marks/ImageLine/Plot/Marks/LineLine/Plot/Marks/LineLinear regression/Plot/Marks/Linear regressionLinear regression/Plot/Marks/Linear regressionLink/Plot/Marks/LinkLink/Plot/Marks/LinkRaster/Plot/Marks/RasterRaster/Plot/Marks/RasterRect/Plot/Marks/RectRect/Plot/Marks/RectRule/Plot/Marks/RuleRule/Plot/Marks/RuleText/Plot/Marks/TextText/Plot/Marks/TextTick/Plot/Marks/TickTick/Plot/Marks/TickTip/Plot/Marks/TipTip/Plot/Marks/TipTree/Plot/Marks/TreeTree/Plot/Marks/TreeVector/Plot/Marks/VectorVector/Plot/Marks/VectorWaffle/Plot/Marks/WaffleWaffle/Plot/Marks/WaffleBin/Plot/Transforms/BinBin/Plot/Transforms/BinCentroid/Plot/Transforms/CentroidCentroid/Plot/Transforms/CentroidDodge/Plot/Transforms/DodgeDodge/Plot/Transforms/DodgeFilter/Plot/Transforms/FilterFilter/Plot/Transforms/FilterGroup/Plot/Transforms/GroupGroup/Plot/Transforms/GroupHexbin/Plot/Transforms/HexbinHexbin/Plot/Transforms/HexbinInterval/Plot/Transforms/IntervalInterval/Plot/Transforms/IntervalMap/Plot/Transforms/MapMap/Plot/Transforms/MapNormalize/Plot/Transforms/NormalizeNormalize/Plot/Transforms/NormalizeSelect/Plot/Transforms/SelectSelect/Plot/Transforms/SelectShift/Plot/Transforms/ShiftShift/Plot/Transforms/ShiftSort/Plot/Transforms/SortSort/Plot/Transforms/SortStack/Plot/Transforms/StackStack/Plot/Transforms/StackTree/Plot/Transforms/TreeTree/Plot/Transforms/TreeWindow/Plot/Transforms/WindowWindow/Plot/Transforms/WindowCrosshair/Plot/Interactions/CrosshairCrosshair/Plot/Interactions/CrosshairPointer/Plot/Interactions/PointerPointer/Plot/Interactions/PointerPlot/PlotIntroduction/Plot/IntroductionFeatures/Plot/FeaturesMarks/Plot/MarksTransforms/Plot/TransformsInteractions/Plot/Interactions