A live bird collage card for your Home Assistant dashboard.
fix deprecation warnings
frederikb99367d29853
diff --git a/scripts/daily_plot.py b/scripts/daily_plot.pyindex bbf46b37..e5cceb2b 100755--- a/scripts/daily_plot.py+++ b/scripts/daily_plot.py@@ -46,7 +46,7 @@ def create_plot(df_plt_today, now, is_top):plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0, hspace=0)# generate y-axis order for all figures based on frequency- freq_order = pd.value_counts(df_plt_selection_today['Com_Name']).index+ freq_order = df_plt_selection_today['Com_Name'].value_counts().index# make color for max confidence --> this groups by name and calculates max confconfmax = df_plt_selection_today.groupby('Com_Name')['Confidence'].max()@@ -58,18 +58,19 @@ def create_plot(df_plt_today, now, is_top):if is_top:# Set Palette for graphicspal = "Greens"- colors = plt.cm.Greens(norm(confmax))+ colors = plt.cm.Greens(norm(confmax)).tolist()plot_type = "Top"name = "Combo"else:# Set Palette for graphicspal = "Reds"- colors = plt.cm.Reds(norm(confmax))+ colors = plt.cm.Reds(norm(confmax)).tolist()plot_type = "Bottom"name = "Combo2"# Generate frequency plot- plot = sns.countplot(y='Com_Name', data=df_plt_selection_today, palette=colors, order=freq_order, ax=axs[0])+ plot = sns.countplot(y='Com_Name', hue='Com_Name', legend=False, data=df_plt_selection_today,+ palette=colors, order=freq_order, ax=axs[0])# Try plot grid lines between bars - problem at the moment plots grid lines on bars - want between barsyticklabels = ['\n'.join(textwrap.wrap(ticklabel.get_text(), 15)) for ticklabel in plot.get_yticklabels()]diff --git a/scripts/plotly_streamlit.py b/scripts/plotly_streamlit.pyindex 0832e4a5..e376ded7 100755--- a/scripts/plotly_streamlit.py+++ b/scripts/plotly_streamlit.py@@ -256,7 +256,7 @@ if daily is False:# filt = df2['Com_Name'] == specieif specie == 'All':- df_counts = int(hourly[hourly.index == specie]['All'])+ df_counts = int(hourly[hourly.index == specie]['All'].iloc[0])fig = make_subplots(rows=3, cols=2,specs=[[{"type": "xy", "rowspan": 3}, {"type": "polar", "rowspan": 2}],@@ -371,7 +371,7 @@ if daily is False:daily = pd.crosstab(df5, df5.index.date, dropna=True, margins=True)fig.add_trace(go.Bar(x=daily.columns[:-1], y=daily.loc[specie][:-1], marker_color='seagreen'), row=3, col=1)st.plotly_chart(fig, use_container_width=True) # , config=config)- df_counts = int(hourly[hourly.index == specie]['All'])+ df_counts = int(hourly[hourly.index == specie]['All'].iloc[0])st.subheader('Total Detect:' + str('{:,}'.format(df_counts))+ ' Confidence Max:' +str('{:.2f}%'.format(max(df2[df2['Com_Name'] == specie]['Confidence']) * 100))