Altair: Additional properties are not allowed ('title' was unexpected)

Created on 16 Sep 2019  路  2Comments  路  Source: altair-viz/altair

Hi @jakevdp,

I have an error with using title when encoding.

Based on customizing your visualization,

alt.Chart(data).mark_bar(color='firebrick').encode(
    alt.Y('a', title='category'),
    alt.X('average(b)', title='avg(b) by category')
)

I got an error:

SchemaValidationError: Invalid specification
altair.vegalite.v2.schema.channels.X, validating 'additionalProperties'
Additional properties are not allowed ('title' was unexpected)

The full code in my jupyter looks like this:

import altair as alt
import pandas as pd

data = pd.DataFrame({'a': list('CCCDDDEEE'),
                     'b': [2, 7, 4, 1, 2, 6, 8, 4, 7]})

alt.Chart(data).mark_bar(color='firebrick').encode(
    alt.Y('a', title='category'),
    alt.X('average(b)', title='avg(b) by category')
)

Any ideas?

Most helpful comment

In case anyone comes across this on the Googles: this issue came up because the user was using Altair version 2.X, which does not support the title property in encoding channels, rather than version 3.0 or newer, which does support the title property.

All 2 comments

Not anymore a problem after choosing the correct environment. Restarted my notebook and it works now.

In case anyone comes across this on the Googles: this issue came up because the user was using Altair version 2.X, which does not support the title property in encoding channels, rather than version 3.0 or newer, which does support the title property.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jakevdp picture jakevdp  路  17Comments

jakevdp picture jakevdp  路  34Comments

pagpires picture pagpires  路  21Comments

jakevdp picture jakevdp  路  48Comments

choldgraf picture choldgraf  路  20Comments