Skip to content

Commit

Permalink
Correct the method-based syntax for a few more gallery examples
Browse files Browse the repository at this point in the history
  • Loading branch information
joelostblom committed Oct 19, 2023
1 parent 9602812 commit 3b9ac58
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions tests/examples_methods_syntax/beckers_barley_facet.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
.sort('-x')
.axis(grid=True),
alt.Color('year:N')
.legend(title="Year"),
.title("Year"),
alt.Row('site:N')
.title("")
.sort(alt.EncodingSortField(field='yield', op='sum', order='descending'))
.sort(field='yield', op='sum', order='descending')
).properties(
height=alt.Step(20)
).configure_view(stroke="transparent")
2 changes: 1 addition & 1 deletion tests/examples_methods_syntax/isotype.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(''),
alt.Shape('animal:N').legend(None).scale(shape_scale),
alt.Color('animal:N').legend(None).scale(color_scale),
).transform_window(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('')
)

area = base.mark_area(opacity=0.3, color='#57A44C').encode(
Expand Down
10 changes: 5 additions & 5 deletions tests/examples_methods_syntax/scatter_with_layered_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
)
Expand Down
3 changes: 1 addition & 2 deletions tests/examples_methods_syntax/seattle_weather_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3b9ac58

Please sign in to comment.