fix deprecation warnings
This commit is contained in:
@@ -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)
|
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
|
# 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 conf
|
# make color for max confidence --> this groups by name and calculates max conf
|
||||||
confmax = df_plt_selection_today.groupby('Com_Name')['Confidence'].max()
|
confmax = 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:
|
if is_top:
|
||||||
# Set Palette for graphics
|
# Set Palette for graphics
|
||||||
pal = "Greens"
|
pal = "Greens"
|
||||||
colors = plt.cm.Greens(norm(confmax))
|
colors = plt.cm.Greens(norm(confmax)).tolist()
|
||||||
plot_type = "Top"
|
plot_type = "Top"
|
||||||
name = "Combo"
|
name = "Combo"
|
||||||
else:
|
else:
|
||||||
# Set Palette for graphics
|
# Set Palette for graphics
|
||||||
pal = "Reds"
|
pal = "Reds"
|
||||||
colors = plt.cm.Reds(norm(confmax))
|
colors = plt.cm.Reds(norm(confmax)).tolist()
|
||||||
plot_type = "Bottom"
|
plot_type = "Bottom"
|
||||||
name = "Combo2"
|
name = "Combo2"
|
||||||
|
|
||||||
# Generate frequency plot
|
# 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 bars
|
# Try plot grid lines between bars - problem at the moment plots grid lines on bars - want between bars
|
||||||
yticklabels = ['\n'.join(textwrap.wrap(ticklabel.get_text(), 15)) for ticklabel in plot.get_yticklabels()]
|
yticklabels = ['\n'.join(textwrap.wrap(ticklabel.get_text(), 15)) for ticklabel in plot.get_yticklabels()]
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ if daily is False:
|
|||||||
|
|
||||||
# filt = df2['Com_Name'] == specie
|
# filt = df2['Com_Name'] == specie
|
||||||
if specie == 'All':
|
if specie == 'All':
|
||||||
df_counts = int(hourly[hourly.index == specie]['All'])
|
df_counts = int(hourly[hourly.index == specie]['All'].iloc[0])
|
||||||
fig = make_subplots(
|
fig = make_subplots(
|
||||||
rows=3, cols=2,
|
rows=3, cols=2,
|
||||||
specs=[[{"type": "xy", "rowspan": 3}, {"type": "polar", "rowspan": 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)
|
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)
|
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)
|
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))
|
st.subheader('Total Detect:' + str('{:,}'.format(df_counts))
|
||||||
+ ' Confidence Max:' +
|
+ ' Confidence Max:' +
|
||||||
str('{:.2f}%'.format(max(df2[df2['Com_Name'] == specie]['Confidence']) * 100))
|
str('{:.2f}%'.format(max(df2[df2['Com_Name'] == specie]['Confidence']) * 100))
|
||||||
|
|||||||
Reference in New Issue
Block a user