Altair: SortField class structure change?

Created on 21 Aug 2018  路  2Comments  路  Source: altair-viz/altair

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?

Most helpful comment

@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

All 2 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxgerma picture maxgerma  路  3Comments

bmcfee picture bmcfee  路  3Comments

pabloinsente picture pabloinsente  路  3Comments

fischcheng picture fischcheng  路  4Comments

Juan-132 picture Juan-132  路  3Comments