I know how to increase the margin on both sides in matplotlib
:
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
ax.set_xmargin(0.3)
ax.plot(range(10), np.random.rand(10))
plt.show()
However, I would like to have a margin only on the right side: something like ax.set_xmargin(left=0.0, right=0.3)
. Is that possible?
I cannot set the axis limits manually because the plot is animated and the data change at every step.