I'm having a bit of trouble adjusting a bar chart created with the pandas. Is it possible to remove the space between the graph and the x and y axes? I am attaching 2 images from before and how I would like (after), I made several attempts but they were not satisfactory.
Thank you for your help
pandas version: 0.21.0
matplotlib version: 2.1.0
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
_file_bmu = '1941070.csv'
df = pd.read_csv(_file_bmu, sep=',', header=None)
df.columns = ['date_str', 'x', 'y']
df['DateTime'] = pd.to_datetime(df['date_str'], format='%d-%m-%Y')
df['day_of_week'] = df.DateTime.dt.strftime('%A')
df['id'] = df.DateTime.dt.strftime('%w')
output = pd.pivot_table(df, index=['id'], values=['x', 'y'], aggfunc= [np.mean, np.std])
output.columns = output.columns.droplevel(0) #remove amount
output.columns.name = None #remove categories
output = output.reset_index() #index to columns
output.columns = ['id','x_mean', 'y_mean','x_std','y_std']
# output.columns = output.columns.droplevel(0)
# output = output.reset_index().rename_axis(None, axis=1)
means = (output[['x_mean', 'y_mean']]).round(2)
means.columns = ['x', 'y']
errors = (output[['x_std', 'y_std']]).round(2)
errors.columns = ['x', 'y']
print('MEANS')
print(means)
print('ERRORS')
print(errors)
fig, ax = plt.subplots()
ax.tick_params(axis='x', which='both', top='off', bottom='off')
means.plot.bar(yerr=errors,ax=ax)
plt.show()
print("END")
1941070.csv file content
02-01-2016,34,45
03-01-2016,35,44
04-01-2016,0,45
05-01-2016,0,43
06-01-2016,7,46
07-01-2016,24,13
08-01-2016,20,0
09-01-2016,34,44
10-01-2016,34,45
11-01-2016,0,45
12-01-2016,0,43
13-01-2016,0,43
14-01-2016,23,12
15-01-2016,20,0
03-02-2016,0,43
06-02-2016,34,44
07-02-2016,34,44
08-02-2016,0,43
09-02-2016,0,41
10-02-2016,7,49
11-02-2016,16,48
12-02-2016,20,0
13-02-2016,19,0
14-02-2016,34,44
15-02-2016,0,45
16-02-2016,0,43
17-02-2016,0,43
18-02-2016,24,13
02-03-2016,6,46
04-03-2016,20,0
06-03-2016,33,45
07-03-2016,0,45
08-03-2016,0,43
09-03-2016,7,46
11-03-2016,20,0
13-03-2016,34,45
14-03-2016,0,45
15-03-2016,0,43
16-03-2016,8,46
17-03-2016,17,47
18-03-2016,24,47
19-03-2016,19,0
01-04-2016,25,47
02-04-2016,20,0
03-04-2016,34,45
04-04-2016,0,45
05-04-2016,0,43
06-04-2016,7,46
07-04-2016,24,12
08-04-2016,20,0
09-04-2016,34,44
10-04-2016,34,45
11-04-2016,0,45
14-04-2016,24,12
15-04-2016,24,48
16-04-2016,19,0
05-05-2016,17,47
08-05-2016,35,47
09-05-2016,0,46
10-05-2016,0,44
11-05-2016,9,47
12-05-2016,15,50
15-05-2016,36,47
16-05-2016,0,47
17-05-2016,0,46
18-05-2016,8,48
19-05-2016,16,48
20-05-2016,22,48
24-05-2016,0,45
25-05-2016,7,47
01-06-2016,7,47
02-06-2016,16,48
06-06-2016,0,46
11-06-2016,28,48
12-06-2016,36,47
13-06-2016,0,46
16-06-2016,15,50
17-06-2016,21,50
18-06-2016,27,48
19-06-2016,35,47
20-06-2016,0,47
23-06-2016,15,49
24-06-2016,23,48
25-06-2016,24,50
01-07-2016,23,48
02-07-2016,36,46
03-07-2016,36,46
04-07-2016,0,45
05-07-2016,0,44
06-07-2016,7,47
09-07-2016,26,49
10-07-2016,35,47
11-07-2016,0,45
12-07-2016,0,44
13-07-2016,7,47
14-07-2016,15,49
15-07-2016,21,50
16-07-2016,35,46
01-08-2016,0,45
03-08-2016,8,47
04-08-2016,16,48
05-08-2016,23,48
06-08-2016,34,46
07-08-2016,36,46
08-08-2016,0,47
10-08-2016,7,47
11-08-2016,16,48
12-08-2016,23,48
13-08-2016,33,45
14-08-2016,34,46
15-08-2016,0,45
16-08-2016,1,46
01-09-2016,15,48
02-09-2016,23,48
03-09-2016,35,45
05-09-2016,0,45
06-09-2016,0,44
07-09-2016,7,50
08-09-2016,15,51
09-09-2016,23,48
10-09-2016,34,45
11-09-2016,34,46
12-09-2016,0,45
13-09-2016,0,44
14-09-2016,7,47
15-09-2016,15,48
01-10-2016,35,46
02-10-2016,36,46
03-10-2016,0,46
04-10-2016,0,44
06-10-2016,15,50
07-10-2016,21,50
09-10-2016,36,46
10-10-2016,0,45
11-10-2016,0,44
12-10-2016,7,48
13-10-2016,15,49
14-10-2016,21,50
15-10-2016,35,46
18-10-2016,0,44
01-11-2016,0,44
03-11-2016,16,48
04-11-2016,23,48
05-11-2016,33,45
06-11-2016,34,46
07-11-2016,0,46
08-11-2016,0,45
09-11-2016,6,47
11-11-2016,20,0
12-11-2016,33,45
13-11-2016,35,46
14-11-2016,0,46
15-11-2016,0,45
16-11-2016,8,48
01-12-2016,15,49
03-12-2016,35,45
04-12-2016,34,46
07-12-2016,7,47
08-12-2016,16,48
09-12-2016,25,47
10-12-2016,32,46
11-12-2016,33,46
12-12-2016,0,47
13-12-2016,0,44
14-12-2016,7,47
15-12-2016,16,48
16-12-2016,23,48
17-12-2016,34,45