{"action":"created","issue":{"url":"https://api.github.com/repos/altair-viz/altair/issues/1137","repository_url":"https://api.github.com/repos/altair-viz/altair","labels_url":"https://api.github.com/repos/altair-viz/altair/issues/1137/labels{/name}","comments_url":"https://api.github.com/repos/altair-viz/altair/issues/1137/comments","events_url":"https://api.github.com/repos/altair-viz/altair/issues/1137/events","html_url":"https://github.com/altair-viz/altair/issues/1137","id":361310845,"node_id":"MDU6SXNzdWUzNjEzMTA4NDU=","number":1137,"title":"custom sorting categorical axis with layers - working in VL3 Editor","user":{"login":"Alcampopiano","id":4624246,"node_id":"MDQ6VXNlcjQ2MjQyNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/4624246?v=4","gravatar_id":"","url":"https://api.github.com/users/Alcampopiano","html_url":"https://github.com/Alcampopiano","followers_url":"https://api.github.com/users/Alcampopiano/followers","following_url":"https://api.github.com/users/Alcampopiano/following{/other_user}","gists_url":"https://api.github.com/users/Alcampopiano/gists{/gist_id}","starred_url":"https://api.github.com/users/Alcampopiano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alcampopiano/subscriptions","organizations_url":"https://api.github.com/users/Alcampopiano/orgs","repos_url":"https://api.github.com/users/Alcampopiano/repos","events_url":"https://api.github.com/users/Alcampopiano/events{/privacy}","received_events_url":"https://api.github.com/users/Alcampopiano/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-18T13:42:02Z","updated_at":"2018-09-19T01:08:32Z","closed_at":null,"author_association":"NONE","body":"Hi Jake,\r\n\r\nNot sure if you've seen the recent[ slack discussion](https://vega-js.slack.com/archives/C4R371X41/p1537207975000100) on this but I wanted to let you know that the following works in the VL3 Editor but not in Altair. I'm referring to the sorting of the Y axis labels. \r\n\r\n```python\r\ndf=pd.DataFrame({'Org': ['school','school','school','school', 'board', 'board', 'board', 'board'],\r\n                 'variable': ['rose', 'dropped', 'maintained', 'failed','rose', 'dropped', 'maintained', 'failed'],\r\n                'percent': [25,25,25,25,25,25,25,25], \r\n                 'position': [12.5, 37.5,62.5, 87.5,12.5, 37.5,62.5, 87.5]})\r\n    \r\nbars=alt.Chart().mark_bar().encode(\r\n    x=alt.X('sum(percent)', title='Percentage of Students'),\r\n    y=alt.Y('Org', sort=['school'], title=None),\r\n    color=alt.Color('variable', title=None),\r\n    order='junk:Q'\r\n)\r\n\r\ntext=alt.Chart().mark_text(align='center', baseline='middle').encode(\r\n    y=alt.Y('Org', sort=['school'], title=None),\r\n    x='position',\r\n    text='percent')\r\n\r\nalt.layer(bars, text, data=df).transform_calculate(\r\n    junk=\"if(datum.variable === 'maintained', 0, if(datum.variable === 'rose', 1, if(datum.variable === 'dropped', 2, 2)))\")\r\n```\r\n![visualization 28](https://user-images.githubusercontent.com/4624246/45691656-019d3a00-bb27-11e8-8802-e2a21cb4496d.png)\r\n\r\nThe VL folks showed me how to get this working and I thought perhaps it would translate to Altair 2.2. I assume it is simply a VL2 versus VL3 difference but wanted to bring it to your attention in case it is helpful for you to know.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/altair-viz/altair/issues/comments/422611398","html_url":"https://github.com/altair-viz/altair/issues/1137#issuecomment-422611398","issue_url":"https://api.github.com/repos/altair-viz/altair/issues/1137","id":422611398,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjYxMTM5OA==","user":{"login":"Alcampopiano","id":4624246,"node_id":"MDQ6VXNlcjQ2MjQyNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/4624246?v=4","gravatar_id":"","url":"https://api.github.com/users/Alcampopiano","html_url":"https://github.com/Alcampopiano","followers_url":"https://api.github.com/users/Alcampopiano/followers","following_url":"https://api.github.com/users/Alcampopiano/following{/other_user}","gists_url":"https://api.github.com/users/Alcampopiano/gists{/gist_id}","starred_url":"https://api.github.com/users/Alcampopiano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alcampopiano/subscriptions","organizations_url":"https://api.github.com/users/Alcampopiano/orgs","repos_url":"https://api.github.com/users/Alcampopiano/repos","events_url":"https://api.github.com/users/Alcampopiano/events{/privacy}","received_events_url":"https://api.github.com/users/Alcampopiano/received_events","type":"User","site_admin":false},"created_at":"2018-09-19T01:08:32Z","updated_at":"2018-09-19T01:08:32Z","author_association":"NONE","body":"@jakevdp No problem, just wanted to let you know about it. Take care."}}
{"actor":{"display_login":"Alcampopiano"}}