Skip to main content

plotting - Creating a stacked area chart


I have imported the following data from Excel:


s = {{{0.166667, 0.333333, 0., 0., 0., 0.166667},
{0.0833333, 0., 0.166667, 0.0833333, 0., 0.166667},
{0.333333, 0.0833333, 0.166667, 0.166667, 0.0833333, 0.166667},

{0.416667, 0.5, 0.583333, 0.666667, 0.833333, 0.333333},
{0., 0.0833333, 0., 0., 0.0833333, 0.},
{0., 0., 0., 0.0833333, 0., 0.166667},
{0., 0., 0.0833333, 0., 0., 0.}}}

My purpose is now to create a stacked area chart in Mathematica, of the kind shown in the diagram below. My question is, how can I do that using my data? enter image description here



Answer



You can use StackedListPlot:


StackedListPlot[s[[1]]]


enter image description here


StackedListPlot[s[[1]], FillingStyle -> {4 -> White}]

enter image description here


Alternatively, you can use ListLinePlot with the option PlotLayout ->"Stacked":


ListLinePlot[s[[1]], PlotLayout -> "Stacked", Filling -> Automatic, 
FillingStyle -> {4 -> White}, PlotRange -> All]

enter image description here


Comments