0

Here is my code:

import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('./Desktop/bike-sharing-dataset/hour.csv', delimiter = ',')
x = df['hr']
y = df['cnt']
# Dot plot created using scatter plot
plt.figure(figsize=(15, 10))
ax = sns.scatterplot(x, y, palette="RdYlGn")
plt.xlim([-1, 24])
plt.ylabel("Total Rental Count")
plt.xlabel("Hour")
plt.title("every day-rental count")
plt.show()

I'd like to get something like this:

1

I have the upper and lower bounds calculated like this:

    def hr_demand_upper_bound(self):
        self.upper_bound = self.hourly_average + 1.96*self.hourly_std/(self.hourly_record)**0.5

    def hr_demand_lower_bound(self):
        self.lower_bound = self.hourly_average - 1.96*self.hourly_std/(self.hourly_record)**0.5
  • If you want to be fancy use plt.fill_between (https://stackoverflow.com/questions/16417496/matplotlib-fill-between-multiple-lines) – Osman Mamun Dec 07 '19 at 02:11

1 Answers1

0

Use plt.plot to plot other lines. You can insert this before the plt.show():

plt.plot(x, upper_bound, '-', color='black')
plt.plot(x, lower_bound, '-', color='black')

The '-' option tells matplotlib to make a dashed line.

Diego Palacios
  • 1,096
  • 6
  • 22