def create_bargraph(uid,ndvi,ndwi,ndre,vari,date): import matplotlib.pyplot as plt; plt.rcdefaults() import numpy as np import matplotlib.pyplot as plt year = date[0:4] month = date[4:6] day = date[6:] date = year+'-'+month+'-'+day+' (in yyyy-mm-dd)' title = 'Index Values for '+date objects = ('NDVI','NDWI','NDRE','VARI') y_pos = np.arange(len(objects)) values = [ndvi,ndwi,ndre,vari] plt.barh(y_pos,values, align='center',alpha=0.5) plt.yticks(y_pos,objects) plt.xlabel('Index Values') plt.ylabel('Index Name') plt.title(title) plt.show() file_name = uid+'_bargraph.png' plt.savefig(file_name) plt.close()