Basic Scatterplot with Defined Axis Limits
You can control the limits of X and Y axis of your plots using matplotlib function plt.xlim()
and plt.ylim()
. In this example, lmplot()
function of seaborn is used to plot a basic scatterplot with iris dataset. There are 2 arguments in these functions;
plt.xlim()
: (left, right)plt.ylim()
: (buttom, top)
# library & dataset
import seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset('iris')
# basic scatterplot
sns.lmplot( x="sepal_length", y="sepal_width", data=df, fit_reg=False)
# control x and y limits
plt.ylim(0, 20)
plt.xlim(0, None)
plt.show()