BubbleHistogram[{{x1,y1},{x2,y2},…}]
plots a bubble histogram of the values {xi,yi}.
BubbleHistogram[{{x1,y1},{x2,y2},…},bspec]
plots a bubble histogram with bins specified by bspec.
BubbleHistogram[{{x1,y1},{x2,y2},…},bspec,hspec]
plots a bubble histogram with bubble sizes computed according to the specification hspec.
BubbleHistogram
BubbleHistogram[{{x1,y1},{x2,y2},…}]
plots a bubble histogram of the values {xi,yi}.
BubbleHistogram[{{x1,y1},{x2,y2},…},bspec]
plots a bubble histogram with bins specified by bspec.
BubbleHistogram[{{x1,y1},{x2,y2},…},bspec,hspec]
plots a bubble histogram with bubble sizes computed according to the specification hspec.
Details
- BubbleHistogram shows the density of data in discrete bins by using bubbles that are sized and colored proportionally with the count of elements in each bin.
- BubbleHistogram[data] by default plots a histogram with equally sized bins chosen to approximate an assumed underlying smooth distribution of the values {xi,yi}.
- The
width of each bin is computed according to the values xi, and the
width according to the values yi. - BubbleHistogram[Tabular[…]cspec] extracts and plots values from the tabular object using the column specification cspec.
- The following forms of column specifications cspec are allowed for plotting tabular data:
-
{colx,coly} histogram values {x,y} from column colx and column coly - The following bin specifications bspec can be given:
-
n use n bins {w} use bins of width w {min,max,w} use bins of width w from min to max {{b1,b2,…}} use bins [b1,b2),[b2,b3),… Automatic determine bin widths automatically "name" use a named binning method {"Log",bspec} apply binning bspec on log transformed data fb apply fb to get an explicit bin specification {b1,b2,…} {xspec,yspec} give different x and y specifications - The binning specification "Log" is taken to use the Automatic underlying binning method.
- Possible named binning methods include:
-
"Sturges" compute the number of bins based on the length of data "Scott" asymptotically minimize the mean square error "FreedmanDiaconis" twice the interquartile range divided by the cube root of sample size "Knuth" balance likelihood and prior probability of a piecewise uniform model "Wand" one-level recursive approximate Wand binning - The function fb in BubbleHistogram[data,fb] is applied to a list of all {xi,yi}, and should return an explicit bin list {{bx1,bx2,…},{by1,by2,…}}. In BubbleHistogram[data,{fx,fy}], fx is applied to the list of xi, and fy to the list of yi.
- Different forms of bubble histograms can be obtained by giving different bin bubble specifications hspec in BubbleHistogram[data,bspec,hspec]. The following forms can be used:
-
"Count" number of elements in each bin "CumulativeCount" cumulative counts "SurvivalCount" survival counts "Probability" fraction of values lying in each bin "Intensity" counts divided by bin area "PDF" probability density function "CDF" cumulative distribution function "SF" survival function "HF" hazard function "CHF" cumulative hazard function {"Log",hspec} log transformed height specification fh heights obtained by applying fh to bins and counts - The function fh in BubbleHistogram[data,bspec,fh] is applied to three arguments: a list of
bins {{bx1,bx2},{bx2,…},…}, a list of
bins {{by1,by2},{by2,…},…} and the corresponding 2D array of counts {{c11,c12,…},{c21,…},…}. The function should return an array of counts to be used for each of the cij. - Only values {xi,yi} that consist of real numbers are assigned to bins; others are taken to be missing.
- BubbleHistogram has the same options as Graphics with the following additions and changes: [List of all options]
-
AspectRatio 1 ratio of height to width ChartElementFunction Automatic how to generate raw graphics for tiles ClippingStyle None how to draw values clipped by PlotRange ColorFunction Automatic how to color the plot ColorFunctionScaling True whether to scale the argument to ColorFunction Frame True whether to draw a frame around the plot FrameTicks Automatic frame tick marks LabelingFunction Automatic how to label elements Method Automatic the method to use for refining the plot PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotInteractivity $PlotInteractivity whether to allow interactive elements PlotLegends None legends for data elements and datasets PlotRange Automatic the range of f or other values to include PlotRangeClipping True whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotStyle Automatic style to use for bubbles PlotTheme $PlotTheme overall theme for the plot ScalingFunctions None how to scale individual coordinates - The arguments supplied to ChartElementFunction are the bin region {{xmin,xmax},{ymin,ymax}}, the bin values lists, and metadata {m1,m2,…}.
- The argument supplied to ColorFunction is the density for each bin.
- With ScalingFunctions->{sx,sy,sz}, the
coordinate is scaled using sx etc. - Style and other options are effectively applied in the order PlotStyle, ColorFunction and ChartElementFunction, with later specifications overriding earlier ones.
-
AlignmentPoint Center the default point in the graphic to align with AspectRatio 1 ratio of height to width Axes False whether to draw axes AxesLabel None axes labels AxesOrigin Automatic where axes should cross AxesStyle {} style specifications for the axes Background None background color for the plot BaselinePosition Automatic how to align with a surrounding text baseline BaseStyle {} base style specifications for the graphic ChartElementFunction Automatic how to generate raw graphics for tiles ClippingStyle None how to draw values clipped by PlotRange ColorFunction Automatic how to color the plot ColorFunctionScaling True whether to scale the argument to ColorFunction ContentSelectable Automatic whether to allow contents to be selected CoordinatesToolOptions Automatic detailed behavior of the coordinates tool Epilog {} primitives rendered after the main plot FormatType TraditionalForm the default format type for text Frame True whether to draw a frame around the plot FrameLabel None frame labels FrameStyle {} style specifications for the frame FrameTicks Automatic frame tick marks FrameTicksStyle {} style specifications for frame ticks GridLines None grid lines to draw GridLinesStyle {} style specifications for grid lines ImageMargins 0. the margins to leave around the graphic ImagePadding All what extra padding to allow for labels etc. ImageSize Automatic the absolute size at which to render the graphic LabelingFunction Automatic how to label elements LabelStyle {} style specifications for labels Method Automatic the method to use for refining the plot PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotInteractivity $PlotInteractivity whether to allow interactive elements PlotLabel None an overall label for the plot PlotLegends None legends for data elements and datasets PlotRange Automatic the range of f or other values to include PlotRangeClipping True whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotRegion Automatic the final display region to be filled PlotStyle Automatic style to use for bubbles PlotTheme $PlotTheme overall theme for the plot PreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic Prolog {} primitives rendered before the main plot RotateLabel True whether to rotate y labels on the frame ScalingFunctions None how to scale individual coordinates Ticks Automatic axes ticks TicksStyle {} style specifications for axes ticks
List of all options
Examples
open all close allBasic Examples (3)
Plot a bubble histogram for a dataset:
BubbleHistogram[RandomVariate[BinormalDistribution[.5], 500]]Include a legend for the bin colors:
BubbleHistogram[RandomVariate[BinormalDistribution[.5], 500], PlotLegends -> Automatic]Plot the probability density function of the data:
data = RandomVariate[BinormalDistribution[.5], 100];BubbleHistogram[data, Automatic, "PDF"]Cumulative distribution function:
BubbleHistogram[data, Automatic, "CDF"]BubbleHistogram[data, Automatic, "SF"]BubbleHistogram[data, Automatic, "HF"]BubbleHistogram[data, Automatic, "CHF"]Scope (14)
Data (8)
Specify the number of bins to use:
data = RandomReal[NormalDistribution[0, 1], {200, 2}];BubbleHistogram[data, 5]Specify a different number of bins to use in x and y:
BubbleHistogram[data, {3, 5}, Mesh -> True]data = RandomReal[NormalDistribution[0, 1], {200, 2}];BubbleHistogram[data, {.5}]Specify a different bin width to use in x and y:
BubbleHistogram[data, {{.5}, {2}}]data = RandomReal[NormalDistribution[0, 1], {200, 2}];BubbleHistogram[data, {-2, 2, 0.5}]Specify different bin delimiters to use in x and y:
BubbleHistogram[data, {{-2, 2, 0.5}, {-3, 3, 1.5}}]Specify bin delimiters as an explicit list:
data = RandomReal[NormalDistribution[0, 1], {500, 2}];BubbleHistogram[data, {{-3, -1, 0, 1, 3}}, Mesh -> All]Specify different bin delimiters to use in x and y:
BubbleHistogram[data, {{{-3, -1, 0, 1, 3}}, {{-1, 0, 2, 3}}}, Mesh -> All]Use different automatic binning methods:
data = RandomReal[NormalDistribution[0, 1], {500, 2}];Table[BubbleHistogram[data, b, PlotLabel -> b], {b, {"Sturges", "Scott", "FreedmanDiaconis", "Wand", "Knuth"}}]Use logarithmically spaced bins:
Table[BubbleHistogram[data, {"Log", b}, PlotLabel -> "Log" <> b], {b, {"Sturges", "Scott", "FreedmanDiaconis", "Wand", "Knuth"}}]Use different height specifications:
data = RandomReal[NormalDistribution[0, 1], {200, 2}];Table[BubbleHistogram[data, Automatic, h, PlotLabel -> h], {h, {"Count", "PDF", "CDF", "SF", "HF", "CHF"}}]Table[BubbleHistogram[data, Automatic, {"Log", h}, PlotLabel -> "Log" <> h], {h, {"Count", "PDF", "CDF", "SF", "HF", "CHF"}}]Use a height function that accumulates the bin counts over the y direction:
accumulatedCount[xBins_, yBins_, counts_] := Block[{newCounts, heights}, newCounts = Flatten[Transpose[counts]];heights = 100 Accumulate[newCounts] / Total[newCounts];Transpose[Partition[heights, {Length[xBins]}]]];BubbleHistogram[RandomReal[NormalDistribution[0, 1], {100, 2}], Automatic, accumulatedCount, ColorFunction -> "FallColors"]Nonreal data is taken to be missing:
BubbleHistogram[{{1, 1}, {2, 2}, {3, 3}, None, {3, 3}, {5, 5}, Missing[], {2, 2}, {1, 1}, foo, {2, 2}, {3, 3}}]Tabular Data (1)
Create a bubble histogram from pH and alcohol values for different wines:
tab = Tabular[ResourceData["Sample Data: Wine Quality"]]BubbleHistogram[tab -> {"PH", "Alcohol"},
FrameLabel -> {"pH", "alcohol content"},
PlotLegends -> Automatic]Increase the number of bins to show finer granularity:
BubbleHistogram[tab -> {"PH", "Alcohol"}, 15, BubbleSizes -> {0.25, 1},
FrameLabel -> {"pH", "alcohol content"},
PlotLegends -> Automatic]Presentation (5)
data = RandomReal[NormalDistribution[0, 1], {200, 2}];BubbleHistogram[data, PlotLabel -> "plot label", FrameLabel -> {"xlabel", "ylabel"}]By default, BubbleHistogram uses both color and size to represent counts:
data = RandomReal[NormalDistribution[0, 1], {200, 2}];BubbleHistogram[data]Use color only to represent counts:
BubbleHistogram[data, BubbleSizes -> {1, 1}, ColorFunction -> "BlueGreenYellow"]Use size only to represent counts:
BubbleHistogram[data, ColorFunction -> None, BubbleSizes -> {0.1, 1}]Add mesh lines to show bin delimiters:
data = RandomReal[NormalDistribution[0, 1], {200, 2}];BubbleHistogram[data, Mesh -> All]Add legends to show bin counts:
data = RandomReal[NormalDistribution[0, 1], {1000, 2}];BubbleHistogram[data, PlotLegends -> Automatic]BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], PlotTheme -> "Detailed"]BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], PlotTheme -> "Minimal"]Options (62)
AspectRatio (3)
By default, BubbleHistogram uses the same width and height:
BubbleHistogram[IconizedObject[«data»]]Specify the height to width ratio:
BubbleHistogram[IconizedObject[«data»], AspectRatio -> 1 / 2]Use Automatic to determine the ratio from the values:
BubbleHistogram[IconizedObject[«data»], AspectRatio -> Automatic]Axes (4)
By default, BubbleHistogram uses a frame instead of axes:
BubbleHistogram[IconizedObject[«data»]]BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True]Use AxesOrigin to specify where the axes intersect:
BubbleHistogram[IconizedObject[«data»], Axes -> True, Frame -> False, AxesOrigin -> {0, 0}]BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> {True, False}]BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> {False, True}]AxesLabel (4)
No axes labels are drawn by default:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True]BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesLabel -> y]BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesLabel -> {x, y}]Use units as automatic labels:
BubbleHistogram[QuantityArray[IconizedObject[«data»], "Meters"], Frame -> False, Axes -> True, AxesLabel -> Automatic]AxesOrigin (2)
The position of the axes is determined automatically:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True]Specify an explicit origin for the axes:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesOrigin -> {0, 0}]AxesStyle (4)
Change the style for the axes:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesStyle -> RGBColor[0.93, 0.27, 0.27]]Specify the style of each axis:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesStyle -> {{Thick, RGBColor[0.93, 0.27, 0.27]}, {Thick, RGBColor[0.4, 0.6, 1]}}]Use different styles for the ticks and the axes:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesStyle -> RGBColor[0.14, 0.8, 0.14], TicksStyle -> RGBColor[0.93, 0.27, 0.27]]Use different styles for the labels and the axes:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesStyle -> RGBColor[0.14, 0.8, 0.14], LabelStyle -> RGBColor[0.93, 0.27, 0.27]]BubbleScale (2)
By default, the diameter of a bubble is proportional to the z value:
BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], BubbleSizes -> {0.1, 1}, BubbleScale -> "Diameter"]Compare area scale to diameter scale:
data = RandomVariate[BinormalDistribution[.5], 100];Table[BubbleHistogram[data, BubbleSizes -> {0.1, 1}, BubbleScale -> scale, PlotLabel -> scale], {scale, {"Area", "Diameter"}}]BubbleSizes (2)
By default, the smallest bubble is rescaled to 20% of its own bin size and the biggest to 100%:
data = RandomVariate[BinormalDistribution[.5], 100];BubbleHistogram[data, Mesh -> All]Change the relative sizes of the smallest and biggest bubbles to their own bin sizes:
BubbleHistogram[data, BubbleSizes -> {0.1, 0.8}, Mesh -> All]Invert the bubble sizes relative to the counts:
data = RandomVariate[BinormalDistribution[.5], 100];BubbleHistogram[data, BubbleSizes -> {1, 0.2}, Mesh -> All]ChartElementFunction (3)
Get a list of built-in settings for ChartElementFunction:
ChartElementData["BubbleHistogram"]For detailed settings, use Palettes ▶ ChartElementSchemes:
Table[BubbleHistogram[RandomVariate[NormalDistribution[], {100, 2}], ChartElementFunction -> cf, PlotLabel -> cf], {cf, {"Bubble", "FadingBubble"}}]Table[BubbleHistogram[RandomVariate[NormalDistribution[], {100, 2}], {1}, ChartElementFunction -> cf, PlotLabel -> cf], {cf, {"GradientBubble", "MarkerBubble", "NoiseBubble", "OscillatingBubble"}}]Table[BubbleHistogram[RandomVariate[NormalDistribution[], {100, 2}], {1}, ChartElementFunction -> cf, PlotLabel -> cf], {cf, {"SphereBubble", "SquareWaveBubble", "TriangleWaveBubble"}}]Write a custom ChartElementFunction:
f[{{xmin_, xmax_}, {ymin_, ymax_}}, _, _] := Rectangle[{xmin, ymin}, {xmax, ymax}, RoundingRadius -> 0.2]BubbleHistogram[RandomVariate[NormalDistribution[], {100, 2}], {1}, ChartElementFunction -> f]ColorFunction (5)
Color by bubble sizes corresponding to the count:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], ColorFunction -> Function[{count}, ColorData["Rainbow"][count]]]BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {500, 2}], ColorFunction -> "SolarColors"]BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {500, 2}], ColorFunction -> (Hue[2 / 5, 2 / 3, #]&)]Use ColorFunctionScaling->False to get unscaled height values:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {500, 2}], ColorFunction -> (Which[# < 5, RGBColor[1, 0.51, 0.51], 5 ≤ # < 15, RGBColor[0.4, 0.6, 1], True, RGBColor[0.93, 0.27, 0.27]]&), ColorFunctionScaling -> False]Use ColorFunction to combine different style effects:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {500, 2}], ColorFunction -> Function[{count}, Directive[ColorData["FuchsiaTones"][1 - count], EdgeForm[Opacity[count]]]]]ColorFunctionScaling (2)
By default, scaled height values are used:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], ColorFunction -> Function[{height}, ColorData["Rainbow"][height]]]Use ColorFunctionScaling->False to get unscaled height values:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {500, 2}], ColorFunction -> (Which[# < 5, RGBColor[1, 0.51, 0.51], 5 ≤ # < 15, RGBColor[0.4, 0.6, 1], True, RGBColor[0.93, 0.27, 0.27]]&), ColorFunctionScaling -> False]ImageSize (6)
Use named sizes such as Tiny, Small, Medium and Large:
{BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", ImageSize -> Tiny], BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", ImageSize -> Small]}Specify the width of the plot:
{BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", ImageSize -> 150], BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", AspectRatio -> 1.5, ImageSize -> 150]}Specify the height of the plot:
{BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", ImageSize -> {Automatic, 150}], BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", AspectRatio -> 2, ImageSize -> {Automatic, 150}]}Allow the width and height to be up to a certain size:
{BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", ImageSize -> UpTo[200]], BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", AspectRatio -> 2, ImageSize -> UpTo[200]]}Specify the width and height for a graphic, padding with space if necessary:
BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", ImageSize -> {200, 300}, Background -> RGBColor[0.4, 0.6, 1]]Use maximum sizes for the width and height:
{BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", ImageSize -> {UpTo[150], UpTo[100]}], BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", AspectRatio -> 2, ImageSize -> {UpTo[150], UpTo[100]}]}Specify the image size as a fraction of the available space:
Framed[Pane[BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Automatic, "PDF", AspectRatio -> 1 / 3, ImageSize -> {Scaled[0.5], Scaled[0.5]}, Background -> RGBColor[0.4, 0.6, 1]], {200, 100}]]LabelingFunction (3)
Use automatic labeling by values through Tooltip and StatusArea:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], 5, LabelingFunction -> Automatic]BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], 5, LabelingFunction -> None]Use Placed to control label placement:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], 5, LabelingFunction -> (Placed[#1, StatusArea]&)]Mesh (5)
Insert mesh lines between bins:
BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Mesh -> Automatic]Insert 15 row mesh lines and 5 column mesh lines:
BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Mesh -> {15, 5}]Specify explicit mesh lines only on the
:
BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], Mesh -> {None, Range[0, 10]}]Specify styles for the mesh lines:
BubbleHistogram[RandomVariate[BinormalDistribution[.5], 100], {1 / 2}, Mesh -> {None, Table[{i / 2 - 3, Hue[i / 12]}, {i, 0, 12}]}]Use MeshAutomatic to draw mesh between bins:
BubbleHistogram[RandomReal[NormalDistribution[0, 1], {200, 2}], {{{-3, -1, 0, 1, 3}}, {{-1, 0, 2, 3}}}, Mesh -> Automatic]MeshStyle (2)
Method (4)
Show data of each dimension on axes:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], Method -> {"DistributionAxes" -> True}]Use a box-whisker glyph to show how data distributes in each dimension:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], Method -> {"DistributionAxes" -> "BoxWhisker"}]BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], Method -> {"DistributionAxes" -> "Histogram"}]Distribution axes change colors according to the color function of the plot:
BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], Method -> {"DistributionAxes" -> "BoxWhisker"}, ColorFunction -> "RustTones"]BubbleHistogram[RandomVariate[NormalDistribution[0, 1], {200, 2}], Method -> {"DistributionAxes" -> "Histogram"}, ColorFunction -> "DeepSeaColors"]PerformanceGoal (1)
Generate a bar chart with interactive highlighting:
data = RandomReal[NormalDistribution[0, 1], {100, 2}];BubbleHistogram[data, PerformanceGoal -> "Quality"]Emphasize performance by disabling interactive behaviors:
BubbleHistogram[data, PerformanceGoal -> "Speed"]Typically, less memory is required for non-interactive charts:
Table[ByteCount@BubbleHistogram[data, PerformanceGoal -> p], {p, {"Quality", "Speed"}}]PlotInteractivity (2)
Histograms with a moderate number of bars automatically have tooltips and mouseover effects:
BubbleHistogram[IconizedObject[«Subscript[data, 1]»]]Turn off all the interactive elements:
BubbleHistogram[IconizedObject[«Subscript[data, 1]»], PlotInteractivity -> False]Ticks (4)
Ticks are placed automatically in each plot:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True]Use TicksNone to not draw any tick marks:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, Ticks -> None]Place tick marks at specific positions:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, Ticks -> {{-2, 0, 3}, {-2, 0, 2}}]Draw tick marks at the specified positions with the specified labels:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, Ticks -> {{{-2, -a}, {0, 0}, {3, b}}, {{-2, -a}, {0, b}, {2, a}}}]TicksStyle (4)
Specify overall ticks style, including the tick labels:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, TicksStyle -> Directive[RGBColor[0.93, 0.27, 0.27], Bold]]Specify tick style for each of the axes:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, TicksStyle -> {Directive[RGBColor[0.93, 0.27, 0.27], Bold], Directive[RGBColor[0.4, 0.6, 1]]}]Specify tick marks with scaled lengths:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, Ticks -> {{{-2, -a, .1}, {0, 0, .2}, {3, b, .45}}, {{-2, -a, .1}, {0, b, .2}, {2, a, .5}}}]Customize each tick with position, length, labeling and styling:
BubbleHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, Ticks -> {{{-2, -a, .1, Directive[RGBColor[0.93, 0.27, 0.27]]}, {0, 0, .2, Directive[Thick, RGBColor[0.93, 0.27, 0.27]]}, {3, b, .45, Directive[Thick, Dashed, RGBColor[0.93, 0.27, 0.27]]}}, {{-2, -a, .1, Directive[RGBColor[0.4, 0.6, 1]]}, {0, b, .2, Directive[Thick, RGBColor[0.4, 0.6, 1]]}, {2, a, .5, Directive[Thick, Dashed, RGBColor[0.4, 0.6, 1]]}}}]Applications (4)
Estimate the density of volcanic craters in western Uganda:
volcanoes = ExampleData[{"Statistics", "UgandaVolcanoes"}];
border = Graphics[{EdgeForm[Thick], Opacity[0], Polygon[ExampleData[{"Statistics", "WesternUgandaBorder"}]]}];Show[ListPlot[volcanoes], border, AspectRatio -> 1]A scaling function for labeling:
cfs[data_, bspec_, hspec_ : Automatic] := With[{cnts = Union[Flatten@Last[HistogramList[data, bspec, hspec]]]}, N@Transpose[{Rescale[cnts], cnts}]
]The estimated density with a scaled legend:
Show[BubbleHistogram[volcanoes, 10, ColorFunction -> "SolarColors", PlotLegends -> Automatic], border]Bubble histogram for a multivariate time slice of a random process:
data = RandomVariate[WienerProcess[3, 4][{7, 10}], 10 ^ 4];BubbleHistogram[data, 20, "PDF"]Analyze TemporalData by plotting a bubble histogram for two-dimensional time slices:
data = TemporalData[«4»];Table[BubbleHistogram[data["SliceData", {.1, y}], Automatic, "PDF"], {y, .2, 1, .1}]Analyze how the weather varies across two years in Champaign:
data = WeatherData["Champaign", "Temperature", {DateObject[{2022, 1, 1}], DateObject[{2024, 1, 1}]}];datetime = Transpose[{AbsoluteTime /@ data["Times"], Normal[data["Values"]]}];Use one month and 5 Celsius degrees as bin widths on x and y directions:
bins = {{Table[AbsoluteTime@DateObject[{2022, i, 1}], {i, 24}]}, {Quantity[5, "DegreesCelsius"]}};Use BubbleHistogram with date scale and the binning information to visualize the data:
BubbleHistogram[datetime, bins, ScalingFunctions -> {"Date", None}, AspectRatio -> 1 / 2, PlotLabel -> "Temperature variations across the year in Champaign"
]Add ticks, mesh, color and styles:
frameticks = {{Transpose[{Range[-20, 40, 5], Quantity[Range[-20, 40, 5], "DegreesCelsius"]}], None},
{Table[{AbsoluteTime@DateObject[{2022, 2i - 1}], Rotate[DateObject[{2022, 2i - 1}], 90Degree]}, {i, 12}], None}};
mesh = {Transpose[{Range[-25, 40, 5], Reverse@Table[Blend[{RGBColor[0.93, 0.27, 0.27], RGBColor[0.4, 0.6, 1]}, i / 10], {i, 14}]}], Automatic} ;
meshstyle = {Directive[{Opacity[0.9]}], Directive[{GrayLevel[0.7], Opacity[0.4]}]};BubbleHistogram[datetime, bins,
AspectRatio -> 1 / 2,
FrameTicks -> frameticks,
Mesh -> mesh,
MeshStyle -> meshstyle,
PlotStyle -> EdgeForm[GrayLevel[0.62]],
PlotLabel -> "Temperature variations across the year in Champaign"
]Properties & Relations (4)
BubbleHistogram automatically determines bins to use based on data:
BubbleHistogram[RandomVariate[NormalDistribution[], {100, 2}]]BubbleHistogram colors the height according to ColorFunction:
BubbleHistogram[RandomVariate[NormalDistribution[], {100, 2}], Automatic, "CDF", ColorFunctionScaling -> False, PlotLegends -> Automatic]Use Histogram3D to visualize data in 3D:
data = RandomVariate[NormalDistribution[], {100, 2}];{Histogram3D[data], BubbleHistogram[data], DensityHistogram[data]}Use DensityHistogram, SmoothDensityHistogram and SmoothHistogram3D to compare estimated distribution with the data:
data = RandomVariate[BinormalDistribution[{2, 2}, {1, 1}, 0.5], 100];{BubbleHistogram[data], DensityHistogram[data], SmoothDensityHistogram[data], SmoothHistogram3D[data]}Possible Issues (1)
BubbleHistogram always shows bubbles as circles disregard the aspect ratio of the bins:
data = RandomVariate[BinormalDistribution[.5], 100];BubbleHistogram[data, {{-3, -1, -0.5, 0, 0.5, 1, 3}}, Mesh -> All]Neat Examples (1)
Show a grid of BubbleHistogram:
PlotGrid[Partition[Table[BubbleHistogram[RandomVariate[BinormalDistribution[ρ], 10 ^ 3], {-3, 3, .25}, ColorFunction -> "SolarColors", PlotLabel -> ρ, ImageSize -> 150, PlotRange -> {{-3, 3}, {-3, 3}}], {ρ, {-.95, -.75, -.5, -.25, 0, .25, .5, .75, .95 }}], 3], ItemSize -> 150]History
Text
Wolfram Research (2026), BubbleHistogram, Wolfram Language function, https://reference.wolfram.com/language/ref/BubbleHistogram.html.
CMS
Wolfram Language. 2026. "BubbleHistogram." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BubbleHistogram.html.
APA
Wolfram Language. (2026). BubbleHistogram. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BubbleHistogram.html
BibTeX
@misc{reference.wolfram_2026_bubblehistogram, author="Wolfram Research", title="{BubbleHistogram}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/BubbleHistogram.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_bubblehistogram, organization={Wolfram Research}, title={BubbleHistogram}, year={2026}, url={https://reference.wolfram.com/language/ref/BubbleHistogram.html}, note=[Accessed: 13-June-2026]}