How do I integrate this matplotlib graph in dash plotly.
import numpy as np
import matplotlib.pyplot as plt
# Data
income_ranges = ['0-399', '400-649', '650']
car_models = ['Hero', 'Kinetic', 'Sun']
rider_count = [
[160, 180, 200],
[80, 90, 100],
[0, 45, 45]
]
# Width of each bar
bar_width = 0.2
# Set the positions of the bars on the x-axis
pos = np.arange(len(income_ranges))
# Plotting the grouped bar graph
fig, ax = plt.subplots()
for i in range(len(car_models)):
ax.bar(pos + i * bar_width, rider_count[i], bar_width, label=car_models[i])
# Adding labels and title
ax.set_xlabel('Income Ranges')
ax.set_ylabel('Rider Count')
ax.set_title('Earnings of Riders by Car Models')
ax.set_xticks(pos + (len(car_models) - 1) * bar_width / 2)
ax.set_xticklabels(income_ranges)
ax.legend()
# Displaying the graph
plt.show()
Help me display this graph in a dash page without converting this to an image.
Can i not return this as a figure just like in plotly go or px?