Reputation: 6864
I have a data frame which is indexed by DataTime in pandas.
I have data about a car with the Inside temperature, Lowest inside temperature, Highest temperature and the same three features for the Outside temperature.
Thus I plot all 6 features like so as a time series, and have tried to use plt.fill_between like so :
car_df[['insideTemp','insideTempLow','insideTempHigh','outsideTemp','outsideTempLow','outsideTempHigh']].plot()
plt.fill_between(car_df['insideTemp'], car_df['insideTempLow'],car_df['insideTempHigh'], data=car_df)
plt.fill_between(car_df['outsideTemp'], car_df['outsideTempLow'],car_df['outsideTempHigh'], data=car_df)
plt.show()
I get 6 lines as desired, however nothing seems to get filled (thus not separating the two categories of indoor and outdoor).
Any ideas? Thanks in advance.
Upvotes: 0
Views: 2763
Reputation: 30991
You passed wrong arguments to fill_between.
The proper parameters are as follows:
For readability, usually there is a need to pass also color parameter.
I performed such a test to draw just 2 lines (shortening column names) and fill the space between them:
car_df[['inside', 'outside']].plot()
plt.fill_between(car_df.index, car_df.inside, car_df.outside,
color=(0.8, 0.9, 0.5));
and got the followig picture:
Upvotes: 1