-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
GSOC: Categorical Axes #6612
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
GSOC: Categorical Axes #6612
Conversation
majfmt = CategoricalLocator() | ||
seq, locs = zip(*axis.unit_data.items()) | ||
majloc = CategoricalFormatter(locs) | ||
majfmt = CategoricalLocator(seq) |
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.
These lines are flipped.
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.
yeah just saw that (was caught because of a failing test!) and fixed it, will commit up
I suggest worrying less about tests at this point and more about getting and end-to-end demonstration that produces a plot with no fatal exceptions. |
The thing is the tests are helping me debug what's breaking my code. At the moment, I can generate a plot, with no exceptions, but the labeling and ticks are off (probably due to vmin/vmax issues going by some test results) so that's where I'm working at.
|
If the tests are helping you, then by all means keep using them. Just try not to let getting full test coverage slow down getting a working prototype. |
Thanks. So I've pinned it down a bit more, in that ticks get set and labels don't:
yields:
The bug is that unit_data isn't getting set as expected and that's messing with everything |
Though as an aside, despite unit_data going wonky, the ticking works even for repeating values, so the conversion apparently works:
and the formatter yields what it's supposed to:
yields
|
"""Holds data that a ConversionInterface subclass relys on | ||
to convert between labels and indexes | ||
""" | ||
return self._unit_data |
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.
You should create an empty unit_data
in the __init__
to avoid strange exception is someone calls the getter before the setter.
UGH! Python 3 dicts are special, so now a todo is wrapping support for them as otherwise this doesn't work and it's my default use case so it has to work:
Which question, can we chain convertors? or should this be wrapped into a decorator..? |
This is closed 'cause I finally got around to the proper methodology of branches for each feature, but it's probably not terrible to since this one was getting really messy anyway. |
This is an ongoing PR and mostly exists to make it easier for @mdboom and @tacaswell to follow what I'm working on and to solicit comments from the other matplotlib developers. The aim is to add support for categorical data, a first pass being adding nominal support for plotting lists of strings (and pandas dateframes) using the unitConversionInterface. I'm working out support for lists of strings phase of this project mostly because I'm not sure how to do type inspection on a dateFrame to see if it's categorical and then how to unpack the dateframe...
Currently using the following as models/getting lost in these weeds:
And would be much obliged if somebody could tell me when these convertors actually kick in. So confused about that....my working framework is that when it comes to the steps involved:
convert: converts input items into floats
axis_info: registers which locators and formatters to use
defualt_units: returns units (often none)
and so:
locator: categorical arguably fixed/show all ticks/categories
formatter: this is what actually labels the categories with the data that gets passed in
And sorry for the commit messages. Every attempt at rebasing has created yet more of 'em.