fig, ax = plt.subplots() #solved by add this line
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
class Economics():
def demand_supply_cruve(self , data=None):
"""Graph demand and supply curve
inputs
--------------------------------
Data is a {price:[] , 'Demand':[1,2,3....] , 'Supply':[1,2,3,....] } per unit
"""
data = data if data != None else {'price':list(range(0,201,10)) ,'Demand':list(range(0,401,20))[::-1] , 'Supply':list(range(0,401,20))}
fig, ax = plt.subplots() #solved by add this line
ax = sns.lineplot(data=pd.DataFrame(data), x="Demand", y="price")
return fig
import streamlit as st
from economics import Economics
st.title("Eco")
eco = Economics()
st.pyplot(eco.demand_supply_cruve())