Function Repository Resource:

HistogramBubbleChart

Source Notebook

Create a bubble chart from a list of points with the size of the bubbles corresponding to the count of points at each location

Contributed by: Willem Nielsen

ResourceFunction["HistogramBubbleChart"][{{x1,y1}, {x2,y2}}]

makes a bubble chart with for 2D data with positions {xi,yi} with sizes based on the count of {xi,yi}.

ResourceFunction["HistogramBubbleChart"][data,bspec]

makes a bubble chart with the sizes of bins specified by bspec.

ResourceFunction["HistogramBubbleChart"][data,bspec,hspec]

makes a bubble chart with sizes of bins specified by bspec and the sizes of the bubbles specified by hspec.

Details

Data can be in the form {{x1,y1}, {x2, y2}, }, or {{{x11,y11}, {x12, y12}, }, {{x21,y21}, {x22, y22}, }}.
Wrappers like Callout or Tooltip are not supported.
The supported values for bspec and hspec are the same as in HistogramList.
ResourceFunction["HistogramBubbleChart"] accepts all the options for BubbleChart.

Examples

Basic Examples (1) 

Create a histogram bubble chart for three values:

In[1]:=
ResourceFunction["HistogramBubbleChart"][{{1, 1}, {1, 1}, {2, 2}}]
Out[1]=

Scope (4) 

Useful for visualizing high density data:

In[2]:=
ResourceFunction["HistogramBubbleChart"][
 RandomVariate[NormalDistribution[0, 2], {200, 2}], {1}]
Out[2]=

Compare two distributions:

In[3]:=
ResourceFunction["HistogramBubbleChart"][
 RandomVariate[NormalDistribution[#, 2], {100, 2}] & /@ {5, 10}, {1}]
Out[3]=

Give options to bubble chart:

In[4]:=
ResourceFunction["HistogramBubbleChart"][
 RandomVariate[NormalDistribution[0, 2], {200, 2}], {1}, ChartStyle -> LightBlue]
Out[4]=

Specify the size function:

In[5]:=
ResourceFunction["HistogramBubbleChart"][
 RandomVariate[NormalDistribution[0, 2], {200, 2}], {2}, "CDF" , ChartStyle -> LightBlue]
Out[5]=

Properties and Relations (1) 

Works similarly to density histogram, but instead of colors corresponding to frequency it uses the size of the bubbles:

In[6]:=
Table[#[RandomVariate[NormalDistribution[], {100, 2}], {1}, ChartElementFunction -> cf, ImageSize -> Small], {cf, {"Bubble", "FadingBubble", "MarkerBubble", "SphereBubble"}}] & /@ {DensityHistogram, ResourceFunction["HistogramBubbleChart"]}
Out[6]=

Possible Issues (1) 

Wrappers are not permitted:

In[7]:=
ResourceFunction["HistogramBubbleChart"][{Labeled[{1, 1}, "Hello"] }]
Out[7]=

Publisher

Willem Nielsen

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 18 April 2025

Related Resources

License Information