Skip to content

Commit

Permalink
Back leveled to Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmo213 committed Aug 3, 2024
1 parent 1f3e00c commit b59c646
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.11.x'
python-version: '3.9.x'
cache: 'pip'
architecture: 'x64'

Expand Down
40 changes: 18 additions & 22 deletions scripts/daily_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ def show_values_on_bars(ax, label):
# Species Count Total
value = '{:n}'.format(p.get_width())
bbox = {'facecolor': 'lightgrey', 'edgecolor': 'none', 'pad': 1.0}
match conf['COLOR_SCHEME']:
case "dark":
ax.text(x, y, value, bbox=bbox, ha='center', va='center', size=9, color='black')
case _:
ax.text(x, y, value, bbox=bbox, ha='center', va='center', size=9, color='darkgreen')
if conf['COLOR_SCHEME'] == "dark":
ax.text(x, y, value, bbox=bbox, ha='center', va='center', size=9, color='black')
else:
ax.text(x, y, value, bbox=bbox, ha='center', va='center', size=9, color='darkgreen')


def wrap_width(txt):
Expand Down Expand Up @@ -80,11 +79,10 @@ def create_plot(df_plt_today, now, is_top=None):

# Set up plot axes and titles
height = max(readings / 3, 0) + 1.06
match conf['COLOR_SCHEME']:
case "dark":
f, axs = plt.subplots(1, 2, figsize=(10, height), gridspec_kw=dict(width_ratios=[3, 6]), facecolor='darkgrey')
case _:
f, axs = plt.subplots(1, 2, figsize=(10, height), gridspec_kw=dict(width_ratios=[3, 6]), facecolor='none')
if conf['COLOR_SCHEME'] == "dark":
f, axs = plt.subplots(1, 2, figsize=(10, height), gridspec_kw=dict(width_ratios=[3, 6]), facecolor='darkgrey')
else:
f, axs = plt.subplots(1, 2, figsize=(10, height), gridspec_kw=dict(width_ratios=[3, 6]), facecolor='none')

# generate y-axis order for all figures based on frequency
freq_order = df_plt_selection_today['Com_Name'].value_counts().index
Expand All @@ -98,13 +96,12 @@ def create_plot(df_plt_today, now, is_top=None):
norm = plt.Normalize(confmax.values.min(), confmax.values.max())
if is_top or is_top is None:
# Set Palette for graphics
match conf['COLOR_SCHEME']:
case "dark":
pal = "Greys"
colors = plt.cm.Greys(norm(confmax)).tolist()
case _:
pal = "Greens"
colors = plt.cm.Greens(norm(confmax)).tolist()
if conf['COLOR_SCHEME'] == "dark":
pal = "Greys"
colors = plt.cm.Greys(norm(confmax)).tolist()
else:
pal = "Greens"
colors = plt.cm.Greens(norm(confmax)).tolist()
if is_top:
plot_type = "Top"
else:
Expand Down Expand Up @@ -153,11 +150,10 @@ def create_plot(df_plt_today, now, is_top=None):
# Set color and weight of tick label for current hour
for label in plot.get_xticklabels():
if int(label.get_text()) == now.hour:
match conf['COLOR_SCHEME']:
case "dark":
label.set_color('white')
case _:
label.set_color('yellow')
if conf['COLOR_SCHEME'] == "dark":
label.set_color('white')
else:
label.set_color('yellow')

plot.set_xticklabels(plot.get_xticklabels(), rotation=0, size=8)

Expand Down

0 comments on commit b59c646

Please sign in to comment.