I am trying to make a bar chart of negative values where the baseline x-axis is at -10 instead of 0 and the values, because they are all -10<x<0
, extend up from the baseline.
If I plot it as is, the bars extend downward:
import matplotlib.pyplot as plt
vals = [-4, -6, -8, -6, -5]
plt.bar(range(len(vals)), vals)
I could fake it in some sense by adding 10 to the data, but then I would have to remove the y-tick values, and I need to keep them.
new_vals = [val + 10 for val in vals]
plt.yticks([])
plt.bar(range(len(new_vals)), new_vals)
So how can I make the second image with the y-ticks of the first image and, preferably, without "faking" any of the data?