可以用seaborn画断轴图吗?

TPW*_*ang 7 python plot axis matplotlib seaborn

我需要用现有数据绘制一个破碎的x轴图(例如下图),我的问题是是否可以使用seaborn API来做到这一点?

在此输入图像描述

Una*_*dra 4

没有我想要的那么漂亮,但是有效。

输出

%matplotlib inline  # If you are running this in a Jupyter Notebook.
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt


x = np.linspace(0, 20, 500)
y = np.sin(x)

f, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, sharey=True)
ax = sns.tsplot(time=x, data=y, ax=ax1)
ax = sns.tsplot(time=x, data=y, ax=ax2)

ax1.set_xlim(0, 6.5)
ax2.set_xlim(13.5, 20)
Run Code Online (Sandbox Code Playgroud)