-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix scatterplot categorical support #9705
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
Conversation
e822765
to
6cb6798
Compare
Interestingly scatter doesn't appear to set the major tick labels? import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.scatter([1., 0.], [0., 3.])
for tt in ax.xaxis.get_majorticklabels():
print(tt) Returns:
Etc.. EDIT: Ooops, need to call Added a new test to |
6cb6798
to
cb61128
Compare
Also fixes #9494 |
Almost fixed Almost fixed Almost fixed Added test Added test Added test Added test
cb61128
to
39a007e
Compare
Two birds with one stone is nice! |
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.
Thanks! Wouldn't know how to fix this 'cause I'm still confused as to why stuff is hitting the convert path without ever being registered.
Backport PR #9705 on branch v2.1.x
@story645 I don't quite know what you mean by "registered". The converter gets initialiazed and attached to the xaxis object. But subsequent calls don't get sent to I'm uneasy about it all because I dont' quite understand why |
OK, I don't like this at all:
in if xdata is not None:
# we only need to update if there is nothing set yet.
if not self.xaxis.have_units():
self.xaxis.update_units(xdata) So thats why Plot, on the other hand, calls:
which always calls So,
|
I've also faced this inconsistency. When I tried to use an empty array for the conversions, this worked: fig, ax = plt.subplots()
ax.plot(["!", "0"], [1, 2], ".") but this didn't fig, ax = plt.subplots()
ax.scatter(["!", "0"], [1, 2]) and in both cases the convertor yields array([ 0., 1.]) |
Fix Categorical Scatterplot support
PR Summary
Fixes #9700
failed. New fix adds new categories if needed when
convert
is called.Not sure if this is right, so feel free to scratch. Passes the tests and examples, so I guess its OK.
PR Checklist