Fixing AttributeError in drawLineColored function
Hi scikit-tda team,
I hope this message finds you well. I've encountered an issue while using the drawLineColored function in the ripser.py file. Specifically, the error "AttributeError: Line2D.set() got an unexpected keyword argument 'lineWidth'" is raised when trying to run the code from the Representative Cocycles notebook available at https://ripser.scikit-tda.org/en/latest/notebooks/Representative%20Cocycles.html.
After investigating, I found that the issue stems from the use of 'lineWidth' with an uppercase 'W' in the drawLineColored function:
def drawLineColored(X, C):
for i in range(X.shape[0]-1):
plt.plot(X[i:i+2, 0], X[i:i+2, 1], c=C[i, :], lineWidth=3)
The correct keyword argument is 'linewidth' with a lowercase 'w'. To address this, I have made the necessary changes to the drawLineColored function, replacing 'lineWidth' with 'linewidth'.
I have created a pull request with these changes. Please review it at your earliest convenience.
Thank you for your time and consideration.
Thank you for noticing this! Yeah, there was a matplotlib api change, and it looks like we missed a spot. I'll roll this into the next release
On Tue, Jan 2, 2024 at 6:57 AM Haruki Nakajima @.***> wrote:
Hi scikit-tda team,
I hope this message finds you well. I've encountered an issue while using the drawLineColored function in the ripser.py file. Specifically, the error "AttributeError: Line2D.set() got an unexpected keyword argument 'lineWidth'" is raised when trying to run the code from the Representative Cocycles notebook available at https://ripser.scikit-tda.org/en/latest/notebooks/Representative%20Cocycles.html .
After investigating, I found that the issue stems from the use of 'lineWidth' with an uppercase 'W' in the drawLineColored function:
def drawLineColored(X, C): for i in range(X.shape[0]-1): plt.plot(X[i:i+2, 0], X[i:i+2, 1], c=C[i, :], lineWidth=3)
The correct keyword argument is 'linewidth' with a lowercase 'w'. To address this, I have made the necessary changes to the drawLineColored function, replacing 'lineWidth' with 'linewidth'.
I have created a pull request with these changes. Please review it at your earliest convenience.
Thank you for your time and consideration.
You can view, comment on, or merge this pull request online at:
https://github.com/scikit-tda/ripser.py/pull/152 Commit Summary
- ae29f62 https://github.com/scikit-tda/ripser.py/pull/152/commits/ae29f6284f4b9797547f17d84f9b0eedb697c2b0 fix/lineWidth -> linewidth
File Changes
(1 file https://github.com/scikit-tda/ripser.py/pull/152/files)
- M docs/notebooks/Representative Cocycles.ipynb https://github.com/scikit-tda/ripser.py/pull/152/files#diff-edf49f380e6f42fe01162afa353faf0692d83673f253ca169ff4322626168ac8 (2)
Patch Links:
- https://github.com/scikit-tda/ripser.py/pull/152.patch
- https://github.com/scikit-tda/ripser.py/pull/152.diff
— Reply to this email directly, view it on GitHub https://github.com/scikit-tda/ripser.py/pull/152, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWDZQ3WEH7XHJSRT4YMTLYMPYZDAVCNFSM6AAAAABBJ53MEGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DEMZRG43TANY . You are receiving this because you are subscribed to this thread.Message ID: @.***>