Repository navigation
Fix scatterplot categorical support - #9705
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! |
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
convertis called.Not sure if this is right, so feel free to scratch. Passes the tests and examples, so I guess its OK.
PR Checklist