Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

brokenaxes AttributeError: 'SubplotSpec' object has no attribute 'is_last_row'

I am trying to use the python brokenaxes to break both x and y axis. I run the code suggested here https://www.codespeedy.com/create-a-plot-with-broken-axis-in-python-using-matplotlib/

import matplotlib.pyplot as plt 
from brokenaxes import brokenaxes 
import numpy as np 
fig = plt.figure(figsize=(6,4)) 
baxes = brokenaxes(xlims=((-2,3),(5,8)), ylims=((0,8),(9.5,21)), hspace=.1) 
X = np.array([3,-1,0,4,5,-2,7]) 
Y = x**2
Z = x**3
baxes.plot(X,Y,label="squared") 
baxes.plot(X,Z,label="cubed") 
baxes.legend(loc="best")
plt.plot()
plt.show()

However I get error:

AttributeError: 'SubplotSpec' object has no attribute 'is_last_row'

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I ran the same code, and I’m able to see the output. But there’s a small typo in your code. You have put lowercase x instead of the variable uppercase X for Y and Z.

enter image description here

Also I installed matplotlib 3.7.1 and brokenaxes 0.5.0. Please check these versions as well

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading