Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: AttributeError: 'LassoSelector' object has no attribute '_props' #25199

Closed
CakmakHi opened this issue Feb 12, 2023 · 3 comments · Fixed by #25404
Closed

[Bug]: AttributeError: 'LassoSelector' object has no attribute '_props' #25199

CakmakHi opened this issue Feb 12, 2023 · 3 comments · Fixed by #25404

Comments

@CakmakHi
Copy link

CakmakHi commented Feb 12, 2023

Summary

I used the LassoSelector object to select the single point in the scatterplot. But when I try to update the line color of LassoSelector with the set_props function, I get an error like this AttributeError: 'LassoSelector' object has no attribute '_props'.

Proposed fix

This warning does not occur when the comment symbol is placed at the beginning of the line "self._props.update(props)" in the "set_ props" function of the matplotlib library's widget.py code.

@oscargus
Copy link
Contributor

The properties for LassoSelector is applied to the line stored as self._selection_artist. As such self._props is not defined in the constructor.

I think the correct solution is to redefine set_props for LassoSelector (and in that method set the props of the line), but there may be someone knowing better.

@oscargus oscargus changed the title [MNT]: AttributeError: 'LassoSelector' object has no attribute '_props' [Bug]: AttributeError: 'LassoSelector' object has no attribute '_props' Feb 12, 2023
@anntzer
Copy link
Contributor

anntzer commented Mar 6, 2023

From a quick look, I'd perhaps try to just get rid of the _props attribute and always store the properties directly in the instantiated artist (creating it as early as possible).

@QuLogic
Copy link
Member

QuLogic commented Mar 7, 2023

It appears that the artist is generally used, and the only real need for _SelectorWidget._props is in SpanSelector.new_axes, which needs to know the properties when attaching a new Axes.

QuLogic added a commit to QuLogic/matplotlib that referenced this issue Mar 7, 2023
This is the only selector widget that needs to remember its properties
separately from the artist, because the artist can be recreated.

Fixes matplotlib#25199
QuLogic added a commit to QuLogic/matplotlib that referenced this issue Mar 7, 2023
This is the only selector widget that needs to remember its properties
separately from the artist, because the artist can be recreated.

Fixes matplotlib#25199
QuLogic added a commit to QuLogic/matplotlib that referenced this issue Mar 8, 2023
This was the only selector widget that needed to remember its properties
separately from the artist, because the artist can be recreated, but we
can copy from the old to new.

Fixes matplotlib#25199
QuLogic added a commit to QuLogic/matplotlib that referenced this issue Mar 8, 2023
This was the only selector widget that needed to remember its properties
separately from the artist, because the artist can be recreated, but we
can copy from the old to new.

Fixes matplotlib#25199
@QuLogic QuLogic added this to the v3.8.0 milestone Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants