I have a graph in python I've made with matplotlib with the following code:
def to_percent(y, position):
s = str(250 * y)
if matplotlib.rcParams['text.usetex'] is True:
return s + r'$\%$'
else:
return s + '%'
distance = df['Distance']
perctile = np.percentile(distance, 90) # claculates 90th percentile
bins = np.arange(0,perctile,2.5) # creates list increasing by 2.5 to 90th percentile
plt.hist(distance, bins = bins, normed=True)
formatter = FuncFormatter(to_percent) #changes y axis to percent
plt.gca().yaxis.set_major_formatter(formatter)
plt.axis([0, perctile, 0, 0.10]) #Defines the axis' by the 90th percentile and 10%Relative frequency
plt.xlabel('Length of Trip (Km)')
plt.title('Relative Frequency of Trip Distances')
plt.grid(True)
plt.show()
What I'd like to know is, is it possible to colour the bars with gradient instead of block colour, like in this picture from excel.
I've not been able to find any information on this.