-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix collections coerce float #21818
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
Fix collections coerce float #21818
Conversation
dcc7c9b
to
958a741
Compare
.. perhaps not necessary for 3.5.1 as I suspect this has been like this for years... |
958a741
to
585a000
Compare
lib/matplotlib/collections.py
Outdated
offsets[:, 0] = self.convert_xunits(offsets[:, 0]) | ||
offsets[:, 1] = self.convert_yunits(offsets[:, 1]) | ||
offsets = np.asarray(offsets, 'float') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to re-cast, is there any reason to hang on to the original array? Can we do np.column_stack((convertx(...), converty(...)))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done. Not sure it is any more elegant, but probably better to convert the x and y arrays separately to float anyway (they can be object arrays, even though convert_xunits has been called, which actually strikes me as a problem in convert_x/yunits.
…818-on-v3.5.x Backport PR #21818 on branch v3.5.x (Fix collections coerce float)
PR Summary
Collections
set_offset
was coercing to float, which ruins any units we want to do. Closes #21803Needs tests....
Tested with
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).