xlim in python code example
Example 1: xlim python
plt.xlim([a,b])
Example 2: set xlim histogram python
import numpy as np
import matplotlib.pyplot as plt
x = np.random.uniform(-100, 100, 1000)
plt.hist(x, bins=30, range=(-50, 50))
plt.show()
Example 3: get xlim python
ax=plt.subplot(111)
ylims=ax.get_ylim()
xlims=ax.get_xlim()