-
Notifications
You must be signed in to change notification settings - Fork 793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an example of reading in years in a convenient manner #3162
Comments
Hi, I would like to take this issue, but I'm not sure it's better to put it under Encoding Data Types or Times and Dates |
Thank you @ChiaLingWeng ! I think either of those places could technically work, but the data that is used in the Encoding Data Type section is more amenable to show this issue since it already has a column with years as integers. Maybe you could expand upon the example already given there and add another similar example with line charts underneath? Something like: pop = data.population().assign(year=lambda df: df['year'].astype(str))
base = alt.Chart(pop).mark_line().encode(
alt.Y('mean(people):Q').title('total population')
).properties(
width=200,
height=200
)
alt.hconcat(
base.encode(x='year:Q').properties(title='year=quantitative'),
base.encode(x='year:O').properties(title='year=ordinal'),
base.encode(x='year:T').properties(title='year=temporal')
) But please feel free to modify as you see fit and for what you think will make the best explanation of this feature. It would be helpful to also add a link in the "Times and Dates" section saying something like "If you want to plot four digit years stored as integers as temporal data, please see the ... section". How does that sound to you? |
Great, you've almost solved it! |
As per @mattijn suggestion here #3140 (reply in thread). Since it is hard to discover it would be great to include it in the docs.
The text was updated successfully, but these errors were encountered: