Hi,
I'm trying to recreate an operation I'd done on a previous project with alt.SortField - just sorting x values based on some y values. I downloaded a notebook that I had run with this previously and it doesn't seem to be working now with Altair 2.2, and I can't seem to find documentation of how the class has changed.
Previous, working project at this nbviewer
It's now throwing an error on the last block:
SchemaValidationError: Invalid specification
altair.vegalite.v2.schema.core.SortField, validating 'additionalProperties'
Additional properties are not allowed ('op' was unexpected)
the crux of it is in the graph variable encoding on the x channel on the last main block of the NBViewer:
.encode(x=alt.X('State:N',sort=alt.SortField(op='mean',field='change', order='descending'))
I've tried reworking it by removing the op argument, nesting SortField into an order argument, along with several other things. Is there any documentation or examples of how this is supposed to work now?
@jtbaker assuming you are on altair 2.2.0+ that method name has been changed.
Here is the relevant part:
Backward-incompatible changes
alt.SortField renamed to alt.EncodingSortField
https://github.com/altair-viz/altair/blob/9bb2044729ee5d9a4ebc4d006036d9502dce0301/CHANGES.md#backward-incompatible-changes-1
@afonit Thanks for the quick response! This resolved my issue. Should have dug through the changes docs a little more - closing now.
Most helpful comment
@jtbaker assuming you are on altair 2.2.0+ that method name has been changed.
Here is the relevant part:
https://github.com/altair-viz/altair/blob/9bb2044729ee5d9a4ebc4d006036d9502dce0301/CHANGES.md#backward-incompatible-changes-1