3
$\begingroup$

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

$\endgroup$
7
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.