incorporated Jake's two suggestions
added in the reasoning he had already provided for casting to another datatype
removed row that was not doing anything.
@@ -9,6 +9,8 @@ from vega_datasets import data
source = data.jobs()
+# The year here is stored by pandas as an integer. When treating columns as dates,
+# it is best to use either a string representation or a datetime representation.
source.year = source.year.astype(str)
welders = source[source.job == 'Welder']
@@ -16,8 +18,7 @@ welders = source[source.job == 'Welder']
chart = alt.Chart(welders).mark_line().encode(
x=alt.X('year', timeUnit='year'),
y=alt.Y('perc', axis=alt.Axis(format='%')),
- color='sex',
- detail='job'
+ color='sex'
).properties(
title='Percent of work-force working as Welders'
)
