I have a database of monthly revenue reports published by the state of kentucky that currently creates the following plot:
However, as the state's fiscal year starts in July, the reported number for FY 2021 is an estimate based on YTD revenue collections so far. As such, I would like to assign a separate color for the 2021 bar that identifies it as an estimate. Below is my code currently, where a dataframe is created by querying a sqlite database and summating the results to show annual totals. Note, for the code rpt_run and rpt_geo are defined variables that just help set the title for the canvas figure. Also the report type is annual so it is executing the first line of the conditional statement that creates the bar chart
def create_plot_canvas(df, rpt_run, rpt_geo, rpt_type):
fig = plt.figure(figsize=(14, 14), frameon=True)
fig.set_facecolor('#b9cde5')
fig.suptitle(rpt_run + ": " + rpt_geo, va='bottom', weight='bold', fontsize='x-large', y=0.90)
ax = fig.add_subplot()
if rpt_type == 'Annual':
img = df.plot.bar(ax=ax, color='#4f81bd', edgecolor='black', figsize=(14,9), width=0.8)
else:
img = df.plot.line(ax=ax, figsize=(14,9))
plt.legend(loc='lower right')
return fig