Skip to content

Commit

Permalink
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 006e5e8 commit c7a1ac6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/covid_19_puerto_rico/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,12 @@ def make_chart(self, df):

heatmap = base.mark_rect().encode(
color=alt.Color('value:Q', title=None, legend=None,
scale=alt.Scale(scheme="redgrey", domainMid=0))
scale=alt.Scale(scheme="redgrey", domainMid=0,
# WORKAROUND: Set the domain manually to forcibly
# include the domainMid or else we run into
# https://github.com/vega/vega-lite/issues/6544
domain=[min(0, df['value'].min()),
max(0, df['value'].max())]))
)

text = base.mark_text(fontSize=9).encode(
Expand Down Expand Up @@ -359,7 +364,12 @@ def make_chart(self, df):

heatmap = base.mark_rect().encode(
color=alt.Color('value:Q', title=None, legend=None,
scale=alt.Scale(scheme="redgrey", domainMid=0))
scale=alt.Scale(scheme="redgrey", domainMid=0,
# WORKAROUND: Set the domain manually to forcibly
# include the domainMid or else we run into
# https://github.com/vega/vega-lite/issues/6544
domain=[min(0, df['value'].min()),
max(0, df['value'].max())]))
)

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

0 comments on commit c7a1ac6

Please sign in to comment.