Code: Select all
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df = pd.read_csv('../RnOut/RAINFALL/Deps/CHIPAT.txt', sep=' ', skipinitialspace=True )
fig, ax = plt.subplots(figsize=(10, 10))
#Drop rows with missing values
#*****************************
df_new = df.drop(df[df['Dep'] = 0 else 'r' for e in df_new['Dep']]
plt.bar(df_new['Year'],df_new['Dep'], color=colors,edgecolor='black')
#Set titles
#**********
ax.set_title('Rainfall Departures: Oct-Mar\n ---------------------------------------')
plt.xlabel("Years")
plt.ylabel("Rainfall Departure (Std Dev)")
ax.grid()
plt.savefig('ChipatDep.png')
plt.show()
< /code>
Meine Beispieldaten < /p>
Year Dep
1945 -0.9
1946 0.9
1947 0.6
1948 -0.7
1949 1.2
1950 -0.9
1951 0.9
1952 0.1
1953 -1.0
1954 1.3
1955 -0.3