Is it possible to set ylim parameters on a seaborn boxplot?
as an example:
y = np.random.randn(300)
sns.boxplot (y=y)
Displays
boxplot
but if I try
ax.set_ylim=(-5, 5)
It makes no difference. Is it possible to set ylim values for a boxplot different from the default ones for a given dataset plot?
You use the axes-approach without having an axes-object.
Try (figure-based approach):
import matplotlib.pyplot as plt
plt.ylim([-5,5])
or probably better in your case:
ax = sns.boxplot (y=y)
ax.set_ylim([-5, 5]) # function! your code-sample is wrong here!
The docs here show the return-value of sns.boxplot.
And here is the general overview of matplotlib's objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With