Pablo - 4 months ago 16x

Python Question

I'd like to color the lower part of a

`tsplot`

`sns.tsplot(time=time,data=data)`

Is it possible to color the lower area of the plot? I tried using

`barplot`

Answer

Try to use `fill_between`

from matplotlib, like here:

```
import numpy as np; np.random.seed(22)
import seaborn as sns; sns.set(color_codes=True)
import matplotlib.pylab as plt
x = np.arange(31)
data = np.sin(x) + np.random.rand(10, 31) + np.random.randn(10, 1)
sns.tsplot(data=data)
ax = plt.gca()
ax.fill_between(x, np.sin(x), ax.get_ylim()[0], color='r')
plt.show()
```

Source (Stackoverflow)

Comments