mirror of
https://github.com/aykhans/AzSuicideDataVisualization.git
synced 2025-04-21 18:23:35 +00:00
19 lines
434 B
Python
19 lines
434 B
Python
"""
|
|
Line Chart with Percent axis
|
|
----------------------------
|
|
This example shows how to format the tick labels of the y-axis of a chart as percentages.
|
|
"""
|
|
# category: line charts
|
|
import altair as alt
|
|
from vega_datasets import data
|
|
|
|
source = data.jobs.url
|
|
|
|
alt.Chart(source).mark_line().encode(
|
|
alt.X('year:O'),
|
|
alt.Y('perc:Q', axis=alt.Axis(format='%')),
|
|
color='sex:N'
|
|
).transform_filter(
|
|
alt.datum.job == 'Welder'
|
|
)
|