I search to draw a catplot with violin plots using seaborn with a broken y-axis ('cause I have a cause consequence process acting at two different scales: one between [0,0.2] and a second between [2,12] of my quantitative y-variable).
I understood from this answer that there is not implemented easy feature allowing this kind of plot in seaborn (yet?) So I tried different approaches, unsuccessful, to stack two plots of the same dataset but with two different scales.
Explored unsuccessful attempt:
Let's use the standard dataset 'exercise', I tried:
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
exercise = sns.load_dataset("exercise")
f, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, sharey=True)
f = sns.catplot(x="time", y="pulse", hue="kind",data=exercise, kind="violin",ax=ax1)
f = sns.catplot(x="time", y="pulse", hue="kind",data=exercise, kind="violin",ax=ax2)
ax1.set_ylim(0, 6.5) # those limits are fake
ax2.set_ylim(13.5, 20)
plt.subplots_adjust(wspace=0, hspace=0)
plt.show()
I also tried to use facegrid but without success
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
exercise = sns.load_dataset("exercise")
g = sns.FacetGrid(exercise, col="kind",row="time")
g.map(sns.catplot, x="time", y="pulse", hue="kind",data=exercise, kind="violin")
plt.show()
here it gives me the right base of grid of plots but plots happen in other figures.