Skip to content

Commit

Permalink
A better workaround for vega/vega-lite#6544
Browse files Browse the repository at this point in the history
  • Loading branch information
sacundim committed May 26, 2020
1 parent c7a1ac6 commit 367c36e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/covid_19_puerto_rico/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,9 @@ def make_chart(self, df):
color=alt.Color('value:Q', title=None, legend=None,
scale=alt.Scale(scheme="redgrey", domainMid=0,
# WORKAROUND: Set the domain manually to forcibly
# include the domainMid or else we run into
# include zero or else we run into
# https://github.com/vega/vega-lite/issues/6544
domain=[min(0, df['value'].min()),
max(0, df['value'].max())]))
domain=alt.DomainUnionWith(unionWith=[0])))
)

text = base.mark_text(fontSize=9).encode(
Expand Down Expand Up @@ -366,10 +365,9 @@ def make_chart(self, df):
color=alt.Color('value:Q', title=None, legend=None,
scale=alt.Scale(scheme="redgrey", domainMid=0,
# WORKAROUND: Set the domain manually to forcibly
# include the domainMid or else we run into
# include zero or else we run into
# https://github.com/vega/vega-lite/issues/6544
domain=[min(0, df['value'].min()),
max(0, df['value'].max())]))
domain=alt.DomainUnionWith(unionWith=[0])))
)

text = base.mark_text(fontSize=4).encode(
Expand Down

0 comments on commit 367c36e

Please sign in to comment.