Dual Axis Chart


I am trying to make dual axis chart in streamlit but ended up in error. can anyone guide me how to make two different y axis on both vertical sides of chart with x axis.


If possible, please share the source code


Use matplotlib’s ax.twinx() function. For example:

fig, ax = plt.subplots(1, figsize=(15,5))
ax_2 = ax.twinx()

# configure ax and ax_2 as you wish
# ...

# Set X label 
ax.set_xlabel('X Label')

# Set twin Y labels 
ax.set_ylabel('Y Label' 1)
ax_2.set_ylabel('Y Label 2')

# Plot the figure

thanks, its working