[SchemaValidationError] 'selection' was unexpected
See original GitHub issueHi,
I am following a Google Colab which uses altair
for visualization.
I don’t plan to use interactive notebook, so I am using altair-viewer
for rendering via Python terminal. Unfortunately, I run into following exception:
raise SchemaValidationError(self, err)
altair.utils.schemapi.SchemaValidationError: Invalid specification
altair.vegalite.v4.schema.channels.Color, validating 'additionalProperties'
Additional properties are not allowed ('selection' was unexpected)
Here is my sample code (same as one found on colab
):
import altair as alt
alt.data_transformers.enable('default', max_rows=None)
alt.renderers.enable('altair_viewer')
# Load data (skipped for brevity)
occupation_filter = alt.selection_multi(fields=["occupation"])
occupation_chart = alt.Chart().mark_bar().encode(
x="count()",
y=alt.Y("occupation:N"),
color=alt.condition(
occupation_filter,
alt.Color("occupation:N", scale=alt.Scale(scheme='category20')),
alt.value("lightgray")),
).properties(width=300, height=300, selection=occupation_filter)
# Explicitly call show
occupation_chart.show()
I have tried both pip install altair
and pip install git+git://github.com/altair-viz/altair.git
Following example from altair
doc seems to work fine from terminal:
>>> import altair as alt
>>>
>>> # load a simple dataset as a pandas DataFrame
... from vega_datasets import data
>>> cars = data.cars()
>>> chart = alt.Chart(cars).mark_point().encode(
... x='Horsepower',
... y='Miles_per_Gallon',
... color='Origin',
... ).interactive()
>>> chart.show()
Displaying chart at http://localhost:21098/
Please guide how to unblock myself. Apologies if this is a noob question, my first time trying altair
.
Thank you!!!
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Altair SchemaValidationError: Invalid specification
Row, validating 'additionalProperties' Additional properties are not allowed ('axis' was unexpected) alt.VConcatChart(...) concatenation ...
Read more >debugging schema validation issues - how to?
I am using Altair 4.1.0. In calling chart.save('foo.html') I get a schema validation error. The actual message was not that informative to me.....
Read more >Schema Validation error (type mismatch)-Custom Connector
Hi, Thank you for your time. I'm working with custom connector created from postman collection, but it is throwing below error. Property.
Read more >Unexpected schema validation error received using ...
When sending a request to a DataPower service that is defined with the XML or Non-XML request type, an unexpected schema validation error...
Read more >Handling Validation Errors - python-jsonschema
Iterable) – the errors to select from. Do not provide a mixture of errors from different validation attempts (i.e. from different instances or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Does what open up charts? None of your code includes the data, so I cannot run it. Try to create a short, complete snippet, with no reference to data files on your computer, that I can copy and paste into a terminal to see the error you’re seeing.
I can’t run your code, because your data does not exist on my system. Can you create a minimal example that reproduces the error?