from matplotlib import pyplot as plt
import numpy as np
def f(x):
return -1.0 * x + np.log(np.exp(x)+3)
x = range(-10,10)
y = [f(_x) for _x in x]
y_label = ["{:.2f}".format(_y) for _y in y]
plt.bar(x, y)
for a, b, label in zip(x, y, y_label):
plt.text(a, b, label, ha='center', va='bottom')
plt.show()
myplot.png