I have a Pandas' Dataframe I would like to visualize using Altair, but it looks like the library syntax is yet above my skills:
Time WL1 WL2 WL3 WL4
0 2017-04-05 09:15:00 103448.0 100776.0 71581.1 81118.2
1 2017-04-05 09:30:00 114730.0 113206.0 68600.1 78322.2
2 2017-04-05 09:45:00 117252.0 114189.0 68208.5 77261.0
3 2017-04-05 10:00:00 115569.0 111300.0 67454.7 75347.4
4 2017-04-05 10:15:00 117504.0 114956.0 68709.9 76345.1
5 2017-04-05 10:30:00 116123.0 112637.0 66210.9 74544.4
6 2017-04-05 10:45:00 111050.0 106342.0 61699.3 70165.2
7 2017-04-05 11:00:00 111221.0 108409.0 66124.6 74842.1
8 2017-04-05 11:15:00 111604.0 106853.0 66950.5 75782.9
9 2017-04-05 11:30:00 113026.0 108071.0 68222.2 77848.0
I cannot find the syntax to create a Streamgraph like this, taken from Altair's tutorial (06-AreaCharts):
I can visualize the single lines but it is not the best representation for my data:
LayeredChart(data,
layers=[
Chart().mark_line().encode(
x='Time:T',
y='WL1:Q',
),
Chart().mark_line().encode(
x='Time:T',
y='WL2:Q',
),
Chart().mark_line().encode(
x='Time:T',
y='WL3:Q',
),
Chart().mark_line().encode(
x='Time:T',
y='WL4:Q',
),
]
)
Is there a way to create a Streamgraph without going through a LayeredChart, directly from the multiple-column dataframe?
This page contains the code for the stream graph.
By the way, you may want to compare the code with the vega-lite json spec to allow you to better understand the Altair syntax.