{"action":"created","issue":{"url":"https://api.github.com/repos/altair-viz/altair/issues/785","repository_url":"https://api.github.com/repos/altair-viz/altair","labels_url":"https://api.github.com/repos/altair-viz/altair/issues/785/labels{/name}","comments_url":"https://api.github.com/repos/altair-viz/altair/issues/785/comments","events_url":"https://api.github.com/repos/altair-viz/altair/issues/785/events","html_url":"https://github.com/altair-viz/altair/issues/785","id":318096425,"node_id":"MDU6SXNzdWUzMTgwOTY0MjU=","number":785,"title":"faceted layered chart errors out while \"validating 'anyOf'\"","user":{"login":"afonit","id":1798497,"node_id":"MDQ6VXNlcjE3OTg0OTc=","avatar_url":"https://avatars3.githubusercontent.com/u/1798497?v=4","gravatar_id":"","url":"https://api.github.com/users/afonit","html_url":"https://github.com/afonit","followers_url":"https://api.github.com/users/afonit/followers","following_url":"https://api.github.com/users/afonit/following{/other_user}","gists_url":"https://api.github.com/users/afonit/gists{/gist_id}","starred_url":"https://api.github.com/users/afonit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afonit/subscriptions","organizations_url":"https://api.github.com/users/afonit/orgs","repos_url":"https://api.github.com/users/afonit/repos","events_url":"https://api.github.com/users/afonit/events{/privacy}","received_events_url":"https://api.github.com/users/afonit/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-04-26T16:01:51Z","updated_at":"2019-01-04T11:01:44Z","closed_at":"2018-04-26T17:40:17Z","author_association":"CONTRIBUTOR","body":"I was trying to reproduce a custom non-altair/vega chart I saw online when I ran into some trouble.\r\n\r\nWhen faceting a chart then layering it - produces this error:\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nSchemaValidationError                     Traceback (most recent call last)\r\nC:\\Users\\jthomp261\\AppData\\Local\\Continuum\\anaconda3\\envs\\data_analysis\\lib\\site-packages\\altair\\vegalite\\v2\\api.py in to_dict(self, *args, **kwargs)\r\n    338         if dct is None:\r\n    339             kwargs['validate'] = 'deep'\r\n--> 340             dct = super(TopLevelMixin, copy).to_dict(*args, **kwargs)\r\n    341 \r\n    342         if is_top_level:\r\n\r\nC:\\Users\\jthomp261\\AppData\\Local\\Continuum\\anaconda3\\envs\\data_analysis\\lib\\site-packages\\altair\\utils\\schemapi.py in to_dict(self, validate, ignore, context)\r\n    252                 self.validate(result)\r\n    253             except jsonschema.ValidationError as err:\r\n--> 254                 raise SchemaValidationError(self, err)\r\n    255         return result\r\n    256 \r\n\r\nSchemaValidationError: Invalid specification\r\n\r\n        altair.vegalite.v2.api.LayerChart->layer->items, validating 'anyOf'\r\n```\r\n\r\nHere is the non-faceted that works:\r\n```python\r\nimport altair as alt\r\nfrom vega_datasets import data\r\n\r\nstocks = data.stocks()\r\n# get the price on the most recent date for the point chart\r\nstocks_max = pd.merge(stocks.groupby('symbol')['date'].max().reset_index(),\r\n                      stocks, on=['symbol', 'date'], how='left')\r\n\r\npoint = alt.Chart(stocks_max).mark_point().encode(\r\n    x='date:T',\r\n    y='price',\r\n    color='symbol')\r\n\r\nline = alt.Chart(stocks).mark_line(color='red').encode(\r\n    x='date:T',\r\n    y='price',\r\n    color='symbol')\r\n\r\nline+point\r\n```\r\n![visualization](https://user-images.githubusercontent.com/1798497/39317264-2743731e-4949-11e8-80f6-3b8c9d8f4608.png)\r\n\r\nNow when I change the\r\n```\r\ncolor='symbol'\r\n```\r\nto\r\n```\r\nrow='symbol'\r\n```\r\nso that the bottom part looks like this:\r\n```python\r\npoint = alt.Chart(stocks_max).mark_point().encode(\r\n    x='date:T',\r\n    y='price',\r\n    row='symbol')\r\n\r\nline = alt.Chart(stocks).mark_line(color='red').encode(\r\n    x='date:T',\r\n    y='price',\r\n    row='symbol')\r\n\r\nline+point\r\n```\r\nI then get the error mentioned above.\r\n\r\nI have searched on this repo and on vega-lite's repo for layered facets with many results of errors but they were all different from this one.  I may be missing something basic here.\r\n\r\nNote: this is not the completed chart, was was going to layer on another bar plot to get some other effect, but hit this roadblock on the way."},"comment":{"url":"https://api.github.com/repos/altair-viz/altair/issues/comments/451414575","html_url":"https://github.com/altair-viz/altair/issues/785#issuecomment-451414575","issue_url":"https://api.github.com/repos/altair-viz/altair/issues/785","id":451414575,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTQxNDU3NQ==","user":{"login":"anitagraser","id":590385,"node_id":"MDQ6VXNlcjU5MDM4NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/590385?v=4","gravatar_id":"","url":"https://api.github.com/users/anitagraser","html_url":"https://github.com/anitagraser","followers_url":"https://api.github.com/users/anitagraser/followers","following_url":"https://api.github.com/users/anitagraser/following{/other_user}","gists_url":"https://api.github.com/users/anitagraser/gists{/gist_id}","starred_url":"https://api.github.com/users/anitagraser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anitagraser/subscriptions","organizations_url":"https://api.github.com/users/anitagraser/orgs","repos_url":"https://api.github.com/users/anitagraser/repos","events_url":"https://api.github.com/users/anitagraser/events{/privacy}","received_events_url":"https://api.github.com/users/anitagraser/received_events","type":"User","site_admin":false},"created_at":"2019-01-04T11:01:44Z","updated_at":"2019-01-04T11:01:44Z","author_association":"NONE","body":"It would be great to add this limitation as a side note to the example at https://altair-viz.github.io/gallery/choropleth_repeat.html. As soon as the user tries to add another map layer, the chart is broken and the error message is rather cryptic. Took me a while to find this issue report. "}}
{"actor":{"display_login":"anitagraser"}}