I am generating a stacked area plot using the seaborn objects class as from my understanding, seaborn barplot does not have stacking capabilities. The objects class is quite versatile but I have run into an issue with how the axis are presented. It only displays 3 dates and all efforts to display all the dates have been difficult.
data sample
t = ["2019-05-10 03:00:00", "2019-05-10 09:00:00", "2019-05-10 15:00:00",
"2019-05-10 21:00:00", "2019-05-11 03:00:00", "2019-05-11 09:00:00",
"2019-05-11 15:00:00", "2019-05-11 21:00:00", "2019-05-12 03:00:00",
"2019-05-12 09:00:00", "2019-05-12 15:00:00", "2019-05-12 21:00:00",
"2019-05-13 03:00:00", "2019-05-13 09:00:00", "2019-05-13 15:00:00",
"2019-05-13 21:00:00", "2019-05-14 03:00:00", "2019-05-14 09:00:00",
"2019-05-14 15:00:00", "2019-05-14 21:00:00", "2019-05-15 03:00:00",
"2019-05-15 15:00:00", "2019-05-16 15:00:00",
"2019-05-10 03:00:00", "2019-05-10 09:00:00", "2019-05-10 15:00:00",
"2019-05-10 21:00:00", "2019-05-11 03:00:00", "2019-05-11 09:00:00",
"2019-05-11 15:00:00", "2019-05-11 21:00:00", "2019-05-12 03:00:00",
"2019-05-12 09:00:00", "2019-05-12 15:00:00", "2019-05-12 21:00:00",
"2019-05-13 03:00:00", "2019-05-13 09:00:00", "2019-05-13 15:00:00",
"2019-05-13 21:00:00", "2019-05-14 03:00:00", "2019-05-14 09:00:00",
"2019-05-14 15:00:00", "2019-05-14 21:00:00", "2019-05-15 03:00:00",
"2019-05-15 15:00:00", "2019-05-16 15:00:00"]
k = ["hit","hit","hit","hit","hit","hit","hit","hit","hit","hit","hit","hit",
"hit","hit","hit","hit","hit","hit","hit","hit","hit","hit","hit",
"mis","mis","mis","mis","mis","mis","mis","mis","mis","mis","mis","mis",
"mis","mis","mis","mis","mis","mis","mis","mis","mis","mis","mis",]
v = [0.1, 0.7, 0.3, 0.4, 0.3, 0.4, 0.5, 0.6, 0.4, 0.3, 0.4, 0.3, 0.4, 0.5,
0.4, 0.5, 0.6, 0.4, 0.3, 0.4, 0.3, 0.4, 0.5,
0.4, 0.3, 0.4, 0.5, 0.6, 0.4, 0.3, 0.4, 0.3, 0.4, 0.5, 0.2, 0.2, 0.3,
0.4, 0.3, 0.4, 0.5, 0.6, 0.4, 0.3, 0.4, 0.3]
mydf = pd.DataFrame({"date":t,"attack":k, "score":v})
mydf['date'] = mydf['date'].apply(lambda x: datetime.datetime.strptime(x, "%Y-%m-%d %H:%M:%S"))
Here is the code I used to build the graph
seaborn_objects.Plot(mydf, x="date", y="score",
color="attack").add(seaborn_objects.Area(), seaborn_objects.Stack())
I tried using matplotlib generate the axis in combination the seaborn objects scale but it ends up losing the temporal spacing and muddles the axis.
f, ax = pyplot.subplots()
data_plot = seaborn_objects.Plot(mydf, x="date", y="score",
color="attack").add(seaborn_objects.Area(), seaborn_objects.Stack()).scale(x=seaborn_objects.Nominal())
pyplot.xticks(rotation=90)
data_plot.on(ax).show()