From 398cb0ce6d7d9c5612fd3956fc396b84d053a64e Mon Sep 17 00:00:00 2001 From: Eitan Lees Date: Wed, 28 Feb 2018 17:24:27 -0500 Subject: [PATCH] Nonlocal URL Fix --- .../v2/examples/aggregate_bar_chart.py | 2 +- .../vegalite/v2/examples/binned_scatterplot.py | 4 ++-- altair/vegalite/v2/examples/boxplot_max_min.py | 15 ++++++++------- .../v2/examples/diverging_stacked_bar_chart.py | 3 +-- altair/vegalite/v2/examples/gantt_chart.py | 2 -- .../v2/examples/gapminder_bubble_plot.py | 8 ++++---- .../vegalite/v2/examples/grouped_bar_chart.py | 2 +- altair/vegalite/v2/examples/histogram.py | 5 +++-- .../histogram_with_a_global_mean_overlay.py | 2 +- .../vegalite/v2/examples/layered_bar_chart.py | 2 +- altair/vegalite/v2/examples/line_percent.py | 18 +++++++----------- .../vegalite/v2/examples/natural_disasters.py | 4 ++-- .../examples/normalized_stacked_bar_chart.py | 2 +- altair/vegalite/v2/examples/ranged_dot_plot.py | 14 +++++++------- altair/vegalite/v2/examples/streamgraph.py | 8 ++++---- .../v2/examples/table_binned_heatmap.py | 10 +++++----- .../v2/examples/table_bubble_plot_github.py | 4 ++-- .../v2/examples/trellis_scatter_plot.py | 10 +++++----- 18 files changed, 55 insertions(+), 60 deletions(-) diff --git a/altair/vegalite/v2/examples/aggregate_bar_chart.py b/altair/vegalite/v2/examples/aggregate_bar_chart.py index 350a978de..d81a673c8 100644 --- a/altair/vegalite/v2/examples/aggregate_bar_chart.py +++ b/altair/vegalite/v2/examples/aggregate_bar_chart.py @@ -7,7 +7,7 @@ import altair as alt from vega_datasets import data -source = data.population() +source = data.population.url chart = alt.Chart(source).mark_bar().encode( x = alt.X('sum(people):Q', axis = alt.Axis(title = 'population')), diff --git a/altair/vegalite/v2/examples/binned_scatterplot.py b/altair/vegalite/v2/examples/binned_scatterplot.py index aa5a641cf..d80cc30cb 100644 --- a/altair/vegalite/v2/examples/binned_scatterplot.py +++ b/altair/vegalite/v2/examples/binned_scatterplot.py @@ -10,7 +10,7 @@ source = data.movies() chart = alt.Chart(source).mark_circle().encode( - x = alt.X('IMDB_Rating', bin = alt.BinParams(maxbins=10)), - y = alt.Y('Rotten_Tomatoes_Rating', bin = alt.BinParams(maxbins=10)), + x = alt.X('IMDB_Rating:Q', bin = alt.BinParams(maxbins=10)), + y = alt.Y('Rotten_Tomatoes_Rating:Q', bin = alt.BinParams(maxbins=10)), size = 'count(*):Q' ) diff --git a/altair/vegalite/v2/examples/boxplot_max_min.py b/altair/vegalite/v2/examples/boxplot_max_min.py index 986b13399..1b417fcfe 100644 --- a/altair/vegalite/v2/examples/boxplot_max_min.py +++ b/altair/vegalite/v2/examples/boxplot_max_min.py @@ -7,14 +7,15 @@ https://vega.github.io/vega-lite/examples/box-plot_minmax_2D_vertical_normalized.html """ import altair as alt +from vega_datasets import data -population = alt.load_dataset('population') +population = data.population.url # Define aggregate fields -lower_box = 'q1(people)' -lower_whisker = 'min(people)' -upper_box = 'q3(people)' -upper_whisker = 'max(people)' +lower_box = 'q1(people):Q' +lower_whisker = 'min(people):Q' +upper_box = 'q3(people):Q' +upper_whisker = 'max(people):Q' # Compose each layer individually lower_plot = alt.Chart(population).mark_rule().encode( @@ -37,11 +38,11 @@ ) middle_tick = alt.Chart(population).mark_tick(color='white', size=5.0).encode( - y='median(people)', + y='median(people):Q', x='age:O', ) chart = alt.layer(lower_plot, middle_plot, upper_plot, - middle_tick) + middle_tick) \ No newline at end of file diff --git a/altair/vegalite/v2/examples/diverging_stacked_bar_chart.py b/altair/vegalite/v2/examples/diverging_stacked_bar_chart.py index 11c005800..d8a3f4b87 100644 --- a/altair/vegalite/v2/examples/diverging_stacked_bar_chart.py +++ b/altair/vegalite/v2/examples/diverging_stacked_bar_chart.py @@ -5,7 +5,6 @@ """ import altair as alt -from vega_datasets import data data = [ { @@ -363,4 +362,4 @@ y = alt.Y('question:N', axis = y_axis), color = alt.Color('type:N', legend=alt.Legend( title='Response'), - scale = color_scale,)) + scale = color_scale,)) \ No newline at end of file diff --git a/altair/vegalite/v2/examples/gantt_chart.py b/altair/vegalite/v2/examples/gantt_chart.py index 661999915..451ada868 100644 --- a/altair/vegalite/v2/examples/gantt_chart.py +++ b/altair/vegalite/v2/examples/gantt_chart.py @@ -5,7 +5,6 @@ """ import altair as alt -from vega_datasets import data data = [ {"task": "A","start": 1, "end": 3}, @@ -15,7 +14,6 @@ source = alt.pd.DataFrame(data) - chart = alt.Chart(source).mark_bar().encode( x = 'start', x2 = 'end', diff --git a/altair/vegalite/v2/examples/gapminder_bubble_plot.py b/altair/vegalite/v2/examples/gapminder_bubble_plot.py index 2dad70490..4fcb1ca66 100644 --- a/altair/vegalite/v2/examples/gapminder_bubble_plot.py +++ b/altair/vegalite/v2/examples/gapminder_bubble_plot.py @@ -7,10 +7,10 @@ import altair as alt from vega_datasets import data -gapminder = data.gapminder_health_income() +gapminder = data.gapminder_health_income.url chart = alt.Chart(gapminder).mark_circle().encode( - x = alt.X('income', scale = alt.Scale(type = 'log')), - y = alt.Y('health', scale = alt.Scale(zero=False)), - size = 'population' + x = alt.X('income:Q', scale = alt.Scale(type = 'log')), + y = alt.Y('health:Q', scale = alt.Scale(zero=False)), + size = 'population:Q' ) \ No newline at end of file diff --git a/altair/vegalite/v2/examples/grouped_bar_chart.py b/altair/vegalite/v2/examples/grouped_bar_chart.py index 4fd394b1d..29dff244b 100644 --- a/altair/vegalite/v2/examples/grouped_bar_chart.py +++ b/altair/vegalite/v2/examples/grouped_bar_chart.py @@ -7,7 +7,7 @@ import altair as alt from vega_datasets import data -source = data.population() +source = data.population.url chart = alt.Chart(source).mark_bar(stroke = 'transparent').encode( x = alt.X('gender:N', scale = alt.Scale(rangeStep = 12), axis = alt.Axis(title = '')), diff --git a/altair/vegalite/v2/examples/histogram.py b/altair/vegalite/v2/examples/histogram.py index c02b3839f..f8e659080 100644 --- a/altair/vegalite/v2/examples/histogram.py +++ b/altair/vegalite/v2/examples/histogram.py @@ -5,8 +5,9 @@ https://vega.github.io/vega-lite/examples/histogram.html """ import altair as alt +from vega_datasets import data -movies = alt.load_dataset('movies') +movies = data.movies.url chart = alt.Chart(movies).mark_bar().encode( x=alt.X("IMDB_Rating", @@ -15,4 +16,4 @@ maxbins=10, )), y='count(*):Q', -) +) \ No newline at end of file diff --git a/altair/vegalite/v2/examples/histogram_with_a_global_mean_overlay.py b/altair/vegalite/v2/examples/histogram_with_a_global_mean_overlay.py index 2197c4ea1..4ca767dea 100644 --- a/altair/vegalite/v2/examples/histogram_with_a_global_mean_overlay.py +++ b/altair/vegalite/v2/examples/histogram_with_a_global_mean_overlay.py @@ -7,7 +7,7 @@ import altair as alt from vega_datasets import data -source = data.movies() +source = data.movies.url bar = alt.Chart(source).mark_bar().encode( x = alt.X('IMDB_Rating:Q', bin = True, axis = None), diff --git a/altair/vegalite/v2/examples/layered_bar_chart.py b/altair/vegalite/v2/examples/layered_bar_chart.py index 6a13f87f9..0be58231c 100644 --- a/altair/vegalite/v2/examples/layered_bar_chart.py +++ b/altair/vegalite/v2/examples/layered_bar_chart.py @@ -7,7 +7,7 @@ import altair as alt from vega_datasets import data -source = data.population() +source = data.population.url chart = alt.Chart(source).mark_bar(opacity = 0.7).encode( x = alt.X('age:O', scale = alt.Scale(rangeStep = 17)), diff --git a/altair/vegalite/v2/examples/line_percent.py b/altair/vegalite/v2/examples/line_percent.py index c57cbadbb..817dd7891 100644 --- a/altair/vegalite/v2/examples/line_percent.py +++ b/altair/vegalite/v2/examples/line_percent.py @@ -7,18 +7,14 @@ import altair as alt 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'] +source = data.jobs.url -chart = alt.Chart(welders).mark_line().encode( - x=alt.X('year', timeUnit='year'), - y=alt.Y('perc', axis=alt.Axis(format='%')), - color='sex' +chart = alt.Chart(source).mark_line().encode( + x=alt.X('year:O'), + y=alt.Y('perc:Q', axis=alt.Axis(format='%')), + color='sex:N' ).properties( title='Percent of work-force working as Welders' ) + +chart.transform = [{"filter": {"field": "job", "equal": "Welder"}}] diff --git a/altair/vegalite/v2/examples/natural_disasters.py b/altair/vegalite/v2/examples/natural_disasters.py index 7732d2e95..239c9de22 100644 --- a/altair/vegalite/v2/examples/natural_disasters.py +++ b/altair/vegalite/v2/examples/natural_disasters.py @@ -7,14 +7,14 @@ import altair as alt from vega_datasets import data -source = data.disasters() +source = data.disasters.url chart = alt.Chart(source).mark_circle(opacity = 0.8, stroke = 'black', strokeWidth = 1).encode( x = alt.X('Year:O', axis = alt.Axis(labelAngle = 0)), y = alt.X('Entity:N'), size = alt.Size('Deaths:Q', scale = alt.Scale(range = [0, 5000]), legend = alt.Legend(title = 'Annual Global Deaths')), - color = alt.Color('Entity', legend = None) + color = alt.Color('Entity:N', legend = None) ).properties(width=600, height=400) chart.transform = [{"filter": "datum.Entity !== 'All natural disasters'"}] diff --git a/altair/vegalite/v2/examples/normalized_stacked_bar_chart.py b/altair/vegalite/v2/examples/normalized_stacked_bar_chart.py index db2e28937..58e362159 100644 --- a/altair/vegalite/v2/examples/normalized_stacked_bar_chart.py +++ b/altair/vegalite/v2/examples/normalized_stacked_bar_chart.py @@ -7,7 +7,7 @@ import altair as alt from vega_datasets import data -source = data.population() +source = data.population.url chart = alt.Chart(source).mark_bar().encode( x = alt.X('age:O', scale = alt.Scale(rangeStep = 17)), diff --git a/altair/vegalite/v2/examples/ranged_dot_plot.py b/altair/vegalite/v2/examples/ranged_dot_plot.py index 96a5409ff..14add8107 100644 --- a/altair/vegalite/v2/examples/ranged_dot_plot.py +++ b/altair/vegalite/v2/examples/ranged_dot_plot.py @@ -7,18 +7,18 @@ import altair as alt from vega_datasets import data -source = data.countries() +source = data.countries.url line = alt.Chart().mark_line(color='#db646f').encode( - x = 'life_expect', - y = 'country', - detail = 'country' + x = 'life_expect:Q', + y = 'country:N', + detail = 'country:N' ).interactive() point = alt.Chart().mark_point(size = 100, opacity = 1, filled = True).encode( - x = 'life_expect', - y = 'country', + x = 'life_expect:Q', + y = 'country:N', color=alt.Color('year:O', scale=alt.Scale( domain=['1955', '2000'], @@ -29,4 +29,4 @@ chart = alt.layer(line + point, data = source, transform = [{'filter': {"field": 'country', "oneOf": ["China", "India", "United States", "Indonesia", "Brazil"]}}, - {'filter': {"field": 'year', "oneOf": [1955, 2000]}}]) + {'filter': {"field": 'year', "oneOf": [1955, 2000]}}]) \ No newline at end of file diff --git a/altair/vegalite/v2/examples/streamgraph.py b/altair/vegalite/v2/examples/streamgraph.py index 75cfc9c7b..20f06f360 100644 --- a/altair/vegalite/v2/examples/streamgraph.py +++ b/altair/vegalite/v2/examples/streamgraph.py @@ -7,12 +7,12 @@ import altair as alt from vega_datasets import data -source = data.unemployment_across_industries() +source = data.unemployment_across_industries.url chart = alt.Chart(source).mark_area().encode( x = alt.X('date:T', timeUnit = 'yearmonth', axis=alt.Axis(format='%Y', domain = False, tickSize = 0)), - y = alt.Y('sum(count)', stack = 'center', axis = None), - color = alt.Color('series', scale=alt.Scale(scheme='category20b')) - ).interactive() + y = alt.Y('sum(count):Q', stack = 'center', axis = None), + color = alt.Color('series:N', scale=alt.Scale(scheme='category20b')) + ).interactive() \ No newline at end of file diff --git a/altair/vegalite/v2/examples/table_binned_heatmap.py b/altair/vegalite/v2/examples/table_binned_heatmap.py index 7dc6fad66..e12b63f64 100644 --- a/altair/vegalite/v2/examples/table_binned_heatmap.py +++ b/altair/vegalite/v2/examples/table_binned_heatmap.py @@ -7,11 +7,11 @@ import altair as alt from vega_datasets import data -source = data.movies() +source = data.movies.url chart = alt.Chart(source).mark_rect().encode( - x = alt.X('IMDB_Rating', bin = alt.BinParams(maxbins=60)), - y = alt.Y('Rotten_Tomatoes_Rating', bin = alt.BinParams(maxbins=40)), - color = alt.Color('count(IMDB_Rating)', + x = alt.X('IMDB_Rating:Q', bin = alt.BinParams(maxbins=60)), + y = alt.Y('Rotten_Tomatoes_Rating:Q', bin = alt.BinParams(maxbins=40)), + color = alt.Color('count(IMDB_Rating):Q', scale=alt.Scale(scheme='greenblue')) -) +) \ No newline at end of file diff --git a/altair/vegalite/v2/examples/table_bubble_plot_github.py b/altair/vegalite/v2/examples/table_bubble_plot_github.py index 176e0ce01..83fea45b9 100644 --- a/altair/vegalite/v2/examples/table_bubble_plot_github.py +++ b/altair/vegalite/v2/examples/table_bubble_plot_github.py @@ -7,9 +7,9 @@ import altair as alt from vega_datasets import data -source = data.github() +source = data.github.url chart = alt.Chart(source).mark_circle().encode( x = alt.X('time:O', timeUnit = 'hours'), y = alt.X('time:O', timeUnit = 'day'), - size = 'sum(count)') + size = 'sum(count):Q') \ No newline at end of file diff --git a/altair/vegalite/v2/examples/trellis_scatter_plot.py b/altair/vegalite/v2/examples/trellis_scatter_plot.py index 31f440458..f1389923f 100644 --- a/altair/vegalite/v2/examples/trellis_scatter_plot.py +++ b/altair/vegalite/v2/examples/trellis_scatter_plot.py @@ -7,10 +7,10 @@ import altair as alt from vega_datasets import data -source = data.movies() +source = data.movies.url chart = alt.Chart(source).mark_point().encode( - x = 'Worldwide_Gross', - y = 'US_DVD_Sales', - column = 'MPAA_Rating' -) + x = 'Worldwide_Gross:Q', + y = 'US_DVD_Sales:Q', + column = 'MPAA_Rating:N' +) \ No newline at end of file