 Statistics - Maple Programming Help

Home : Support : Online Help : Graphics : Statistics : Statistics/BubblePlot

Statistics

 BubblePlot
 generate bubble plots

 Calling Sequence BubblePlot(X, Y, Z, options, plotoptions) BubblePlot['interactive'](X, Y, Z)

Parameters

 X - first data sample Y - second data sample Z - third data sample options - (optional) equation(s) of the form option=value where option is one of data_legend, bubble_legend, time_range, format, frames, or bubble_scale; specify options for generating the bubble plot plotoptions - options to be passed to the plots[display] command

Options

 The options argument can contain one or more of the options shown below. All unrecognized options will be passed to the plots[display] command. See plot/options for details.
 • The following options can only be used if X, Y, and Z contain time series data.
 • data_legend = list(string)
 If used, this option must be a list of strings containing three elements exactly, specifying what the data contained in X, Y, and Z represent.
 • bubble_legend = list(string)
 If used, this option must have the same number of elements as the number of elements in X, Y, or Z. Give a name to each bubble which is displayed in a legend.
 • time_range = {string, integer, range(string), range(integer), identical(auto)}
 If a string or string range is passed, an attempt is made to deduce the format, unless the format option is passed. An integer or integer range is interpreted as timestamps. Using a single string or integer produces a static plot except when the frames option is set to an integer. Use non-singleton range to generate an animated plot. The default is $\mathrm{auto}$, which sets the start time to the earliest time such that at least one bubble can be displayed, and the end time to the latest time such that all the bubbles can be displayed.
 • format = string
 Time format string to be used when parsing time_range. See StringTools:-ParseTime.
 • frames = {identical(auto, daily, weekly, monthly, quarterly, annual), posint}
 The time points at which the frames are generated. The default, $\mathrm{auto}$, will try to deduce the frequency of the time series containing most data points in the time range to be plotted. It generates frames that are uniform distance apart and fit closely to the times of the data contained in that time series, covering the time range determined by time_range as much as possible (except when this procedure would result in more than $400$ frames being plotted). If the frequency cannot be deduced or would result in more than $400$ frames being plotted, then the $400$ frames are plotted at uniform distance apart, covering the entire time range as determined by time_range. If one of $\mathrm{daily}$, $\mathrm{weekly}$, $\mathrm{monthly}$, $\mathrm{quarterly}$, or $\mathrm{annual}$ is passed, then the first frame is at the start time as determined by time_range. For any frame, if advancing in time by an amount according to frames, such as one month, would not be past end time, then one more frame is plotted. Otherwise, the current frame is the last frame. If an integer is passed, then exactly that number of frames is plotted. Frames generated at time points that are not contained in the time series are interpolated.
 • bubble_scale = numeric
 The bubble sizes will change if the plot region in the worksheet is resized and this option changes the sizes of the bubbles relative to the size of the plot region. The sizes of the bubbles are normalized so that given the same plot region size and bubble_scale value, the maximum of the bubble sizes over the entire time range is same even with different data. bubble_scale changes the sizes relative to the plot region size. Between bubbles, their relative values are represented by their relative sizes. For instance, a bubble with half the area of another bubble represents a value that is half of the other. The default is $1$, which does not change the sizes. A value of $0.5$ halves the area, and a value of $2$ doubles the area. A value between $0.2$ and $3$ will usually produce good results.

Description

 • The BubblePlot command generates a bubble plot for the specified data. The center of each bubble is defined by the values of the corresponding points in the first and the second data sets. The size of the bubbles is proportionate to the magnitude of the corresponding point in the third data set. Filled bubbles represent positive values.
 • The first parameter X is the first data sample - given as a Vector for example.
 • The second parameter Y is the second data sample - given as a Vector for example.
 • The third parameter Z is the third data sample - given as a Vector for example. Note that X, Y, and Z must have the same number of elements.
 • If the parameters X, Y, and Z all contain time series data (either time series objects or time series references), an animated plot is generated by default, where the corresponding time series defines the position and size of the bubbles over time. This will not work with the ['interactive'] option.
 • If the ['interactive'] option is used, a dialog box appears that allows for customized creation of the plot.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $X≔⟨1,2,3,4,5,6,7,8,9,9⟩:$
 > $Y≔⟨1,4,2,3,3,1,5,1,5,5⟩:$
 > $Z≔⟨5,2,-3,-4,5,2,-1,2,1,1⟩:$

This is the command to create the plot from the Plotting Guide using the data above.

 > $\mathrm{BubblePlot}\left(X,Y,Z\right)$ Use time series data to create animated plots. Compare the GDP, industry share of GDP, and services share of GDP of a few countries.

 > $\mathrm{with}\left(\mathrm{DataSets}\right):$
 > $\mathrm{ds1}≔\mathrm{Vector}\left(\left[\mathrm{Reference}\left("quandl","WORLDBANK/USA_NV_SRV_TETC_ZS"\right),\mathrm{Reference}\left("quandl","WORLDBANK/CAN_NV_SRV_TETC_ZS"\right),\mathrm{Reference}\left("quandl","WORLDBANK/DEU_NV_SRV_TETC_ZS"\right),\mathrm{Reference}\left("quandl","WORLDBANK/JPN_NV_SRV_TETC_ZS"\right)\right]\right)$
 $\left[\begin{array}{c}\mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\\ \mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\\ \mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\\ \mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\end{array}\right]$ (1)
 > $\mathrm{ds2}≔\mathrm{Vector}\left(\left[\mathrm{Reference}\left("quandl","WORLDBANK/USA_NV_IND_TOTL_ZS"\right),\mathrm{Reference}\left("quandl","WORLDBANK/CAN_NV_IND_TOTL_ZS"\right),\mathrm{Reference}\left("quandl","WORLDBANK/DEU_NV_IND_TOTL_ZS"\right),\mathrm{Reference}\left("quandl","WORLDBANK/JPN_NV_IND_TOTL_ZS"\right)\right]\right)$
 $\left[\begin{array}{c}\mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\\ \mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\\ \mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\\ \mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\end{array}\right]$ (2)
 > $\mathrm{ds3}≔\mathrm{Vector}\left(\left[\mathrm{Reference}\left("quandl","ODA/USA_PPPGDP"\right),\mathrm{Reference}\left("quandl","ODA/CAN_PPPGDP"\right),\mathrm{Reference}\left("quandl","ODA/DEU_PPPGDP"\right),\mathrm{Reference}\left("quandl","ODA/JPN_PPPGDP"\right)\right]\right)$
 $\left[\begin{array}{c}\mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\\ \mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\\ \mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\\ \mathbf{module}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}...\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end module}\end{array}\right]$ (3)
 > $\mathrm{BubblePlot}\left(\mathrm{ds1},\mathrm{ds2},\mathrm{ds3},\mathrm{data_legend}=\left["Services share of GDP","Industry share of GDP","GDP \left(PPP\right)"\right],\mathrm{bubble_legend}=\left["USA","Canada","Germany","Japan"\right]\right)$ Set the time range to one year, frames to daily, half the bubble sizes, and add a title.

 > $\mathrm{BubblePlot}\left(\mathrm{ds1},\mathrm{ds2},\mathrm{ds3},\mathrm{data_legend}=\left["Services share of GDP","Industry share of GDP","GDP \left(PPP\right)"\right],\mathrm{bubble_legend}=\left["USA","Canada","Germany","Japan"\right],\mathrm{time_range}="1999-01-01".."1999-12-31",\mathrm{frames}=\mathrm{daily},\mathrm{bubble_scale}=0.5,\mathrm{title}="GDP in 1999"\right)$ Generate a single non-animated plot with time series.

 > $\mathrm{BubblePlot}\left(\mathrm{ds1},\mathrm{ds2},\mathrm{ds3},\mathrm{data_legend}=\left["Services share of GDP","Industry share of GDP","GDP \left(PPP\right)"\right],\mathrm{bubble_legend}=\left["USA","Canada","Germany","Japan"\right],\mathrm{time_range}="2005-03-15"\right)$ > 

Compatibility

 • The Statistics[BubblePlot] command was updated in Maple 2015.
 • The data_legend, bubble_legend, time_range, format, frames and bubble_scale options were introduced in Maple 2015.