image thumbnail

densityScatterChart

version 1.1 (1.53 MB) by Dave B
A scatter where the color (and/or transparency) of the markers indicates the density of points.

93 Downloads

Updated 17 Dec 2021

From GitHub

View license on GitHub

densityScatterChart
Density Scatter Chart is a scatter where the color (and/or transparency) of the markers indicates the density of points.
The chart is implemented using ChartContainer, and is intended to highlight some good practices for using this tool to develop a chart. Read the official documentation for more information about ChartContainer and developing your own custom chart classes.
How to use
Create a chart where color varies with density
x=randn(1000,1);
y=randn(1000,1)
densityScatterChart(x,y);
Set properties by passing in Name-Value pairs
% Create a chart where transparency varies with density:
densityScatterChart(x, y, 'UseColor', false, 'UseAlpha', true);
% Specify a title:
densityScatterChart(x, y, "Title", "My density scatter chart");
Set properties after creating the chart:
d=densityScatterChart(x, y);
% Make a steeper density view
d.DensityExponent = 2;
% Use alpha, but make it a subtle effect by using a small range:
d.AlphaRange = [.2 .8];
Changes in version 1.1
Bug Fixes:
  • Fixed ColorbarVisible, which in turn enables the toolbar button in the figure window.
  • Fixed behavior of custom set colormaps when saving to and loading from .fig files.
  • Fixed 'ksdensity' option for DensityMethod.
  • Added extrapolation logic for the 'binned' DenistyMethod to ensure that all points get assigned a color/alpha.
Features:
  • Added XLabel, YLabel, and ColorbarLabel properties.
  • Added an unmanage method which converts the chart into 'traditional' MATLAB graphics objects for advanced editing.
  • Moved property help to a linked static method.

Cite As

Dave B (2022). densityScatterChart (https://github.com/MATLAB-Graphics-and-App-Building/densityScatterChart/releases/tag/v1.1), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with R2020b and later releases
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.