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?
Answer
You can use StackedListPlot
:
StackedListPlot[s[[1]]]
StackedListPlot[s[[1]], FillingStyle -> {4 -> White}]
Alternatively, you can use ListLinePlot
with the option PlotLayout ->"Stacked"
:
ListLinePlot[s[[1]], PlotLayout -> "Stacked", Filling -> Automatic,
FillingStyle -> {4 -> White}, PlotRange -> All]
Comments
Post a Comment