Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6038 > unrolled thread
| Started by | Deep <deepankar.sharma@gmail.com> |
|---|---|
| First post | 2011-10-30 09:29 +0000 |
| Last post | 2011-10-31 12:10 +0000 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Plotting stacked lineplots Deep <deepankar.sharma@gmail.com> - 2011-10-30 09:29 +0000
Re: Plotting stacked lineplots Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-10-31 11:55 +0000
Re: Plotting stacked lineplots Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-10-31 11:49 +0000
Re: Plotting stacked lineplots "Chris Degnen" <degnen@cwgsy.net> - 2011-10-31 12:10 +0000
| From | Deep <deepankar.sharma@gmail.com> |
|---|---|
| Date | 2011-10-30 09:29 +0000 |
| Subject | Plotting stacked lineplots |
| Message-ID | <j8j5ef$f7l$1@smc.vnet.net> |
Is it possible to use mathematica to plot stacked lineplots as shown at http://www-958.ibm.com/software/data/cognos/manyeyes/page/Stack_Graph_for_Categories.html ? Regards, Deepankar
[toc] | [next] | [standalone]
| From | Armand Tamzarian <mike.honeychurch@gmail.com> |
|---|---|
| Date | 2011-10-31 11:55 +0000 |
| Message-ID | <j8m2bj$rtv$1@smc.vnet.net> |
| In reply to | #6038 |
On Oct 30, 8:29 pm, Deep <deepankar.sha...@gmail.com> wrote:
> Is it possible to use mathematica to plot stacked lineplots as shown
> athttp://www-958.ibm.com/software/data/cognos/manyeyes/page/Stack_Graph...
> ?
>
> Regards,
> Deepankar
Yes.
Suppose you have say 6 lists of date list data, and that each data set
has identical dates
data = {data1, data2, data3, data4, data5, data6};
the values at each date are data[[All, All, 2]]
so you can make a cumulative set of values
newData = data;
newData[[All, All, 2]] = Transpose[MapThread[Accumulate[{#1, ##2}] &,
data[[All, All, 2]]]]
and once you have your new data you can plot it
range = Range[0, Length[data]];
DateListPlot[newData, Joined -> True,
Filling -> (MapThread[#2 -> {{#1}, ColorData[3, #2]} &, {Most[range],
Rest[range]}] /. {0} -> Bottom)
]
note that the filling might need some tweeking.
Mike
[toc] | [prev] | [next] | [standalone]
| From | Armand Tamzarian <mike.honeychurch@gmail.com> |
|---|---|
| Date | 2011-10-31 11:49 +0000 |
| Message-ID | <j8m211$rjc$1@smc.vnet.net> |
| In reply to | #6038 |
On Oct 30, 8:29 pm, Deep <deepankar.sha...@gmail.com> wrote:
> Is it possible to use mathematica to plot stacked lineplots as shown
> athttp://www-958.ibm.com/software/data/cognos/manyeyes/page/Stack_Graph...
> ?
>
> Regards,
> Deepankar
just modifying a post I sent a couple of minutes ago. I was doing it
on the fly and it was a tad overcomplicated. Replace this line:
newData[[All, All, 2]] = Transpose[MapThread[Accumulate[{#1, ##2}] &,
data[[All, All, 2]]]]
with this one:
newData[[All, All, 2]] = Accumulate[data[[All, All, 2]]]
Mike
[toc] | [prev] | [next] | [standalone]
| From | "Chris Degnen" <degnen@cwgsy.net> |
|---|---|
| Date | 2011-10-31 12:10 +0000 |
| Message-ID | <j8m374$s3s$1@smc.vnet.net> |
| In reply to | #6038 |
It can be done like this:
data = Table[Accumulate[RandomReal[{0, 1}, 100]], {6}];
stackeddata = Accumulate[data];
preliminary = ListPlot[stackeddata];
colours = Cases[preliminary, _Hue, Infinity];
fillingspec =
Array[# - 1 -> {{#}, Lighter[colours[[#]]]} &,
Length[colours]] /. (0 -> {{1}, col_}) -> (1 -> {Axis, col});
ListLinePlot[stackeddata, Filling -> fillingspec]
Deep wrote:
>
> Is it possible to use mathematica to plot stacked lineplots as shown
> at
> http://www-958.ibm.com/software/data/cognos/manyeyes/page/Stack_Graph_for_Categories.html
> ?
>
> Regards,
> Deepankar
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web