From cb5ab758ec62d60357a132b98119cf39bbfc9761 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Tue, 28 Mar 2023 13:36:34 -0700 Subject: [PATCH] Simplify syntax (#2991) --- .../bar_chart_with_labels.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/examples_arguments_syntax/bar_chart_with_labels.py b/tests/examples_arguments_syntax/bar_chart_with_labels.py index 2ac67b464..a477bb471 100644 --- a/tests/examples_arguments_syntax/bar_chart_with_labels.py +++ b/tests/examples_arguments_syntax/bar_chart_with_labels.py @@ -7,19 +7,12 @@ import altair as alt from vega_datasets import data -source = data.wheat() -bars = alt.Chart(source).mark_bar().encode( - x='wheat:Q', - y="year:O" -) +source = data.wheat() -text = bars.mark_text( - align='left', - baseline='middle', - dx=3 # Nudges text to right so it doesn't appear on top of the bar -).encode( - text='wheat:Q' +base = alt.Chart(source).encode( + x='wheat', + y="year:O", + text='wheat' ) - -(bars + text).properties(height=900) +base.mark_bar() + base.mark_text(align='left', dx=2)