MATLAB: Inconsistent sizes of bubbles in bubble chart

1bubblebubblechartbubbleschart;inconsistentMATLABsize;smallest

According to the documentation of "bubblechart", the area of the bubbles should be proportional to the third input argument of the function. When plotting 10 bubbles with sizes 1:10, for the bubbles with size 2:10, this behavior seems to be consistent. But the size of the first bubble does not fit into that pattern and it appears too small.
x = (1:10)';
bubblechart(x,x,x);

Best Answer

In a bubble chart you can control both the limits on the data and the limits on the (on screen) bubble sizes by using the "bubblelim" and "bubblesize" commands respectively. In the default case "bubblelim" is the range of data ([1 10] here) and "bubblesize" is the diameter units ([3 50] here). Thus the smallest bubble maps on to a marker with a diameter of 3 and the largest bubble maps on to a marker with a diameter of 50, the ratio of the largest to smallest bubble area is 50^2 / 3^2, but the ratio of the largest to smallest data unit is 10/1. The implication is that we can't make the ratio of areas from bubble 2 to bubble 1 match the ratio of areas from bubble 4 to bubble 2. Hence the difference in area between each bubble is made identical, matching the difference in data values.
In order for the bubble are ratios to match, you can set the bubble sizes to have the same ratio as the data. Because the "bubblesize" command accepts "MarkerSizes" (which refer to diameter) the inputs should include a sqrt e.g. bubblesize(sqrt([1 10])*n) where "n" is a scaling factor.
x = (1:10)';
bubblechart(x,x,x);
bubblesize(sqrt([1 10])*10);
Related Question