Scatter plot
Scatter plots are useful for comparing the relationship of two metrics across many items.


Anatomy#


Options#
Behaviors#

Hover#
Hovering over a point on the scatter plot causes all other points to fade back from the view. A tooltip displays the name of the point as well as any correlating values. It can also include metadata such as an image, description, or information that is not shown on the chart.

Selection#
Points can be interactive. When they are, leverage a selected state and surface relevant actions in a panel, rail, or floating menu.

Focus#
A scatter plot can be navigated using a keyboard. Focus begins with the entire chart and moves from left to right. A blue border is applied to the point in focus.

Zoom#
Users should be able to zoom in and out of a scatter plot with a scroll action, much like they would on a map. Include a control to reset the zoom to the default view position.

Pan#
Users should be able to pan over a scatter plot by clicking and dragging within its bounds, much like they would on a map. Include a control to reset the pan to the default view position.

Excluded items#
The chart title or other surrounding elements should help a user understand if any points are excluded from the scatter plot.

Loading#
Charts often require time to load, so include a loading state.

Null values#
When data returns null (blank) values, those values should be excluded. Excluded values should be explained using non-removable tags.

Empty state#
When there is no data available, a chart should indicate as such and give direction as to how to make data appear there. Do not render an empty chart.

Error state#
There are occasionally errors with fetching data. When this happens, give users a helpful, actionable explanation of what happened and what they can do to fix things. Do not render an empty chart.
Usage guidelines#
Don't give each point a unique color#
Color should only be used to help make pattern detection easier. Do not use color as a way to label each point.




Show all points#
One of the advantages of a scatter plot is its ability to show many points — thousands if needed — and still remain legible and performant. Don’t exclude data points unless they’re truly not needed. If any data points are excluded, identify how many in a tag below the chart.


Consider point size#
The size of points should be optimized based on the size of the chart and the number of points there are to display.




Use "multiply" blend mode#
A point’s position on a scatter plot is essential to its readability. This often means that points will overlap. In order to help visualize this overlap, scatter plots should use a 100% opacity with a “multiply” blend mode. This is the best way to visualize the density of overlapping points.




Use transparency as a fallback#
Transparency should only be used when the “multiply” blend mode is not an option. It’s not as useful as multiply, but is still better than completely opaque points.




Don't use shapes#
Shapes as scatter plot points can be difficult to tell apart, especially when they overlap. Use colors or small multiples when you need to show how a scatter plot relates across dimensions.




Support zooming and panning#
Scatter plots can be very data rich. Support exploration by allowing users to zoom in and out of the plot. This is also important when users need to make a precise selection.


Use a Voronoi hitbox#
To maximize the usability of a scatterplot, use a hidden Voronoi map to determine the click/hover area for each point.


Provide context by labeling zones#
Even with axis labels, scatter plots can be difficult to understand. Add zone labels to parts of a scatterplot to make it easier for users to understand the chart.


Keyboard interactions#
Changelog#
- Updated all colors to 6.0.0
- This component has been added to the website
Design checklist#

All interactive states
Includes all interactive states that are applicable (hover, down, focus, keyboard focus, disabled).

All color themes
Works properly across all four color themes (lightest, light, dark, darkest).

All platform scales
Includes a desktop scale (UWP, macOS, web desktop) and a mobile scale (iOS, Android, web mobile).

Accessible use of color
Color is not used as the only visual means of conveying information (WCAG 2.0 1.4.1).

Accessible contrast for text
Text has a contrast ratio of at least 4.5:1 for small text and at least 3:1 for large text (WCAG 2.0 1.4.3).

Accessible contrast for UI components
Visual information required to identify components and states (except inactive components) has a contrast ratio of at least 3:1 (WCAG 2.1 1.4.11).

Content design
UI language and information design considerations have been incorporated into component design.

Defined options
Includes relevant options (variant, style, size, orientation, optional iconography, decorations, selection, error state, etc.)

Defined behaviors
Includes guidelines for keyboard focus, layout (wrapping, truncation, overflow), animation, interactions, etc.

Usage guidelines
Includes a list of dos and don'ts that highlight best practices and common mistakes.

Writing guidelines
Includes content standards or usage guidelines for how to write or format in-product content for the component.

Internationalization guidelines
Works properly across various locales and includes guidelines for bi-directionality (RTL).

Keyboard interactions
Follows WCAG 2.0 standards for keyboard accessibility guidelines and includes a description of the keyboard interactions.

Design tokens
All design attributes (color, typography, layout, animation, etc.) are available as design tokens.

UI kit
Includes a downloadable XD file that shows multiple options, states, color themes, and platform scales.

Generated UI kit
Includes a downloadable XD file, generated by code using design tokens defined in Spectrum DNA, and shows multiple options, states, color themes, and platform scales.

In Spectrum for Adobe XD plugin
Component is included in the Spectrum for Adobe XD plugin.