From bdeeab42f117f19b5b99abe2d91d3d9cf63914ec Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Wed, 18 Oct 2023 19:36:39 -0700 Subject: [PATCH] Correct a few examples --- tests/examples_methods_syntax/isotype.py | 2 +- .../layered_chart_with_dual_axis.py | 2 +- .../scatter_with_layered_histogram.py | 10 +++++----- .../seattle_weather_interactive.py | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/examples_methods_syntax/isotype.py b/tests/examples_methods_syntax/isotype.py index 92850b729..ec31e6256 100644 --- a/tests/examples_methods_syntax/isotype.py +++ b/tests/examples_methods_syntax/isotype.py @@ -69,7 +69,7 @@ alt.Chart(source).mark_point(filled=True, opacity=1, size=100).encode( alt.X('x:O').axis(None), alt.Y('animal:O').axis(None), - alt.Row('country:N').header(title=''), + alt.Row('country:N').title(None), alt.Shape('animal:N').legend(None).scale(shape_scale), alt.Color('animal:N').legend(None).scale(color_scale), ).transform_window( diff --git a/tests/examples_methods_syntax/layered_chart_with_dual_axis.py b/tests/examples_methods_syntax/layered_chart_with_dual_axis.py index d14fbca57..6f6cd86d6 100644 --- a/tests/examples_methods_syntax/layered_chart_with_dual_axis.py +++ b/tests/examples_methods_syntax/layered_chart_with_dual_axis.py @@ -11,7 +11,7 @@ source = data.seattle_weather() base = alt.Chart(source).encode( - alt.X('month(date):T').axis(title=None) + alt.X('month(date):T').title(None) ) area = base.mark_area(opacity=0.3, color='#57A44C').encode( diff --git a/tests/examples_methods_syntax/scatter_with_layered_histogram.py b/tests/examples_methods_syntax/scatter_with_layered_histogram.py index 995766ead..2cec75902 100644 --- a/tests/examples_methods_syntax/scatter_with_layered_histogram.py +++ b/tests/examples_methods_syntax/scatter_with_layered_histogram.py @@ -37,8 +37,8 @@ ).add_params(selector) points = base.mark_point(filled=True, size=200).encode( - x=alt.X('mean(height):Q').scale(domain=[0,84]), - y=alt.Y('mean(weight):Q').scale(domain=[0,250]), + alt.X('mean(height):Q').scale(domain=[0,84]), + alt.Y('mean(weight):Q').scale(domain=[0,250]), color=alt.condition( selector, 'gender:N', @@ -47,13 +47,13 @@ ) hists = base.mark_bar(opacity=0.5, thickness=100).encode( - x=alt.X('age') + alt.X('age') .bin(step=5) # step keeps bin size the same .scale(domain=[0,100]), - y=alt.Y('count()') + alt.Y('count()') .stack(None) .scale(domain=[0,350]), - color=alt.Color('gender:N', scale=color_scale) + alt.Color('gender:N').scale(color_scale) ).transform_filter( selector ) diff --git a/tests/examples_methods_syntax/seattle_weather_interactive.py b/tests/examples_methods_syntax/seattle_weather_interactive.py index 46b7448e4..8c59a83d9 100644 --- a/tests/examples_methods_syntax/seattle_weather_interactive.py +++ b/tests/examples_methods_syntax/seattle_weather_interactive.py @@ -11,11 +11,10 @@ source = data.seattle_weather() -scale = alt.Scale( +color = alt.Color('weather:N').scale( domain=['sun', 'fog', 'drizzle', 'rain', 'snow'], range=['#e7ba52', '#a7a7a7', '#aec7e8', '#1f77b4', '#9467bd'] ) -color = alt.Color('weather:N', scale=scale) # We create two selections: # - a brush that is active on the top panel