I want to generate a stacked graph
with matplotlib, and I want to use wiggle
option. For example:
import matplotlib.pyplot as plt
vals = [[0, 1, 1, 2, 3], [0, 0, 2, 4, 4], [1, 1, 2, 2, 2]]
xs = [0, 1, 2, 3, 4]
plt.stackplot(xs, vals, baseline='wiggle')
plt.show()
This draws something like this:
But I want something more (not necessary exactly) like this:
My problem is, that on y
-axis there are negative values. This is the result
of using baseline='wiggle'
, but I need to use wiggle
, because with zero
,
the plot is not clear and readable enough.
The y
-values or thickness/width of the whole stackplot is the main reason
why I'm making the graph, so I'd like to show that at the end, the
thickness/width of the whole plot is 9
.
What I want:
- to indicate whole stackplot thickness/width at several
x
-positions (5 should be ok) - to keep the graph as clean and simple as possible
- solution should be simple (otherwise it's simpler to "draw" numbers on finished graph manually)
What I don't want (need):
- negative values on
y
-axis - I don't need exactly the same look as in the picture above, I just need some way of indicatin thickness/width..
What I tried:
- using
baseline='zero'
- the graph is too confusing, can't usezero
- deleting
y
-ticks (plt.yticks([], [])
) and adding annotations manually - this means I have to create annotations every time data changes. And it looks just ugly.
Is there any other simple way how to display whole stackplot thickness/width in a meaningful way?
Also, I'm ok with "no, there is no simple way of doing this, either you have to write it yourself or do it manually" answer.