ripser.py icon indicating copy to clipboard operation
ripser.py copied to clipboard

Fixing AttributeError in drawLineColored function

Open Luftalian opened this issue 2 years ago • 1 comments

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.

Luftalian avatar Jan 02 '24 11:01 Luftalian

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

File Changes

(1 file https://github.com/scikit-tda/ripser.py/pull/152/files)

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: @.***>

ctralie avatar Jan 03 '24 14:01 ctralie