The following code gives me bar charts that give a count per category. I would like to overlay the median value of a numeric feature per unique category.
What would I need to add to the following code?
def plot_bars(xy_merge, cols):
for col in cols:
fig = plt.figure(figsize=(6,6)) # define plot area
ax = fig.gca() # define axis
counts = xy_merge[col].value_counts() # find the counts for each unique category
counts.plot.bar(ax = ax, color = 'blue') # Use the plot.bar method on the counts data frame
ax.set_title('Counties and median log rental per categorical variable: ' + col) # Give the plot a main title
ax.set_xlabel(col) # Set text for the x axis
ax.set_ylabel('Count')# Set text for y axis
plt.show()
plot_cols = ['state', 'rucc', 'urban_influence']
plot_bars(xy_merge, plot_cols)