I'm trying to make a plot with 2 breaks in the x-axis. I can produce one break following the matplotlib
days = list(range(0,500))
values = list(np.random.randint(low = 10,high=100,size=len(days)))
fig = plt.figure(figsize=(5, 5))
f,(ax,ax2) = plt.subplots(1,2,sharey=True, facecolor='w')
ax.plot(days, values)
ax2.plot(days, values)
ax.set_xlim(0,100) # x-axis range limited to 0 - 100
ax2.set_xlim(250, 300) # x-axis range limited to 250 - 300
# hide the spines between ax and ax2
ax.spines['right'].set_visible(False)
ax2.spines['left'].set_visible(False)
ax.yaxis.tick_left()
ax.tick_params(labelright='off')
d = .015 # how big to make the diagonal lines in axes coordinates
# arguments to pass plot, just so we don't keep repeating them
kwargs = dict(transform=ax.transAxes, color='k', clip_on=False)
ax.plot((1-d,1+d), (-d,+d), **kwargs)
ax.plot((1-d,1+d),(1-d,1+d), **kwargs)
kwargs.update(transform=ax2.transAxes) # switch to the bottom axes
ax2.plot((-d,+d), (1-d,1+d), **kwargs)
ax2.plot((-d,+d), (-d,+d), **kwargs)
plt.show()
However, how can I modify this to have another break to have an ax3 between 400 and 500? Additionally, how can I scale the x-axis length to be reflective of the length of the interval? In the above I would ideally like the right side reduced as it is half the interval.
I have tried using the brokenaxes which looks like it would meet the criteria automatically scaling and allowing multiple breaks refer to here e.g. https://test-brokenaxes.readthedocs.io/en/latest/auto_examples/plot_usage.html#sphx-glr-auto-examples-plot-usage-py
However, when running that code I get
AttributeError: 'SubplotSpec' object has no attribute 'is_last_row'
Any assistance appreciated.


is_last_rowbecame deprecated in 3.4, so I assumebroken axeshasn't been updated to account for that. matplotlib.org/stable/api/_as_gen/…