Function Repository Resource:

ListGrowthPlot

Source Notebook

Plot the growth of lists and temporal data

Contributed by: Mark Greenberg

ResourceFunction["ListGrowthPlot"][{n1,n2,}]

plots the percentage growth of n.

ResourceFunction["ListGrowthPlot"][{n11,n12,},{n21,n22,},]

plots the percentage growth of each list of n.

ResourceFunction["ListGrowthPlot"][td]

plots the percentage growth of TemporalData td.

Details and Options

If td is a TemporalData object with more than one path, ResourceFunction["ListGrowthPlot"][td] plots all paths.
ResourceFunction["ListGrowthPlot"] takes the same options as ListLinePlot and DateListPlot with the following additions and changes:
AspectRatioImageratio of height to width
"BalancePoint"1zero growth point on the x-axis for all lists
FrameNonewhether to put a frame around the plot
InterpolationOrder2polynomial degree of curves used in joining data points
PlotRangeAutomaticthis setting is overridden and has no effect
TicksAutomaticthis setting is overridden and has no effect

Examples

Basic Examples (2) 

Plot the percentage growth of a list of numbers:

In[1]:=
dat1 = {43, 48.8, 41, 49.2, 53, 60.1};
ResourceFunction["ListGrowthPlot"][dat1]
Out[1]=
Image

Plot the percentage growth of multiple lists of numbers:

In[2]:=
dat2 = Table[RandomReal[{5, 10}, 8], 3];
ResourceFunction["ListGrowthPlot"][dat2, ImageSize -> Medium]
Out[2]=
Image

Scope (2) 

Plot the percentage growth of a time series:

In[3]:=
v = {4, 2.5, 6, 5, 7, 4};
t = {1, 2, 5, 10, 12, 15};
ts = TimeSeries[v, {t}];
ResourceFunction["ListGrowthPlot"][ts, ImageSize -> Medium]
Out[3]=
Image

Plot the percentage growth of multiple paths within one TemporalData object:

In[4]:=
ResourceFunction["ListGrowthPlot"][
 TemporalData[{{100, 121, 96, 89, 99, 107}, {43, 39, 37, 41, 48, 47}},
   Automatic], ImageSize -> Medium]
Out[4]=
Image

Options (1) 

BalancePoint (1) 

All plotted lines meet at {b, 0} where b is the value of the option "BalancePoint":

In[5]:=
dat2 = Table[RandomReal[{5, 15}, 8], 3];
Table[ResourceFunction["ListGrowthPlot"][dat2, "BalancePoint" -> b, ImageSize -> Medium], {b, {1, 3, 5, 7}}]
Out[5]=
Image

Applications (2) 

Plot the performance of two stock investments, even though the stock prices are different:

In[6]:=
dates = {"Sep. 1, 2019", "Dec. 31, 2019"};
path1 = FinancialData["MSFT", dates];
path2 = FinancialData["AAPL", dates];
ResourceFunction["ListGrowthPlot"][TemporalData[{path1, path2}],
 PlotLabels -> {"Microsoft", "Apple"},
 ImageSize -> Large]
Out[6]=
Image

Compare the changes in population of two countries, even though the populations are of vastly different magnitude:

In[7]:=
co1 = CountryData["UnitedStates", {"Population", {1950, 2010}}];
co2 = CountryData["Belize", {"Population", {1950, 2010}}];
ResourceFunction["ListGrowthPlot"][TemporalData[{co1, co2}], PlotLabels -> {"USA", "Belize"},
 ImageSize -> Large]
Out[7]=
Image

Possible Issues (1) 

Percentage change from zero is meaningless, so an error occurs if the value of the balance point is zero for any of the lines plotted:

In[8]:=
lst1 = {4.0, 3.3, 5.7};
lst2 = {0, 2.8, 5.5};
ResourceFunction["ListGrowthPlot"][{lst1, lst2}]
Image
Out[8]=
Image

Publisher

Mark Greenberg

Version History

  • 1.0.0 – 04 March 2020

License Information