plotting.py
def avg_price_fig(choosen_df):
    '''
    Make fugure Average Price by month
    INPUT: dataframe
    OUTPUT: figure, plotly.graph_objects
    '''
    fig = go.Figure()
    for m in set(choosen_df["Year"]):
        color = colors[m % 10]
        fig.add_trace(
            go.Bar(
                x=choosen_df["Month"],
                y=choosen_df[choosen_df["Year"] == m]["Average"],
                name=m,
                text=m,
                textposition="inside",
                insidetextanchor="start",
                hovertemplate="<br>Price: %{y}",
                marker_color=color,
                showlegend=False,
            )
        )

    fig.update_layout(
        barmode="group",
        title={
            "text": "Average Price",
            "y": 0.9,
            "x": 0.5,
            "xanchor": "center",
            "yanchor": "top",
        },
        yaxis_title="Price ($)",
    )
    return fig

    Make fugure Average Price by month
    INPUT: dataframe
    OUTPUT: figure, plotly.graph_objects
    
Make fugure Average Price by month
INPUT: dataframe
OUTPUT: figure, plotly.graph_objects
Make fugure Average Price by month INPUT : dataframe OUTPUT : figure plotly . graph_objects
def avg_price_fig(choosen_df):
    fig = go.Figure()
    for m in set(choosen_df["Year"]):
        color = colors[m % 10]
        fig.add_trace(
            go.Bar(
                x=choosen_df["Month"],
                y=choosen_df[choosen_df["Year"] == m]["Average"],
                name=m,
                text=m,
                textposition="inside",
                insidetextanchor="start",
                hovertemplate="<br>Price: %{y}",
                marker_color=color,
                showlegend=False,
            )
        )
    fig.update_layout(
        barmode="group",
        title={
            "text": "Average Price",
            "y": 0.9,
            "x": 0.5,
            "xanchor": "center",
            "yanchor": "top",
        },
        yaxis_title="Price ($)",
    )
    return fig
def avg_price_fig ( choosen_df ) : fig = go . Figure ( ) for m in set ( choosen_df [ "Year" ] ) : color = colors [ m % 10 ] fig . add_trace ( go . Bar ( x = choosen_df [ "Month" ] , y = choosen_df [ choosen_df [ "Year" ] == m ] [ "Average" ] , name = m , text = m , textposition = "inside" , insidetextanchor = "start" , hovertemplate = "<br>Price: %{y}" , marker_color = color , showlegend = False , ) ) fig . update_layout ( barmode = "group" , title = { "text" : "Average Price" , "y" : 0.9 , "x" : 0.5 , "xanchor" : "center" , "yanchor" : "top" , } , yaxis_title = "Price ($)" , ) return fig
Make fugure Average Price by month
INPUT: dataframe
OUTPUT: figure, plotly.graph_objects
Make fugure Average Price by month INPUT : dataframe OUTPUT : figure plotly . graph_objects
'''
    Make fugure Average Price by month
    INPUT: dataframe
    OUTPUT: figure, plotly.graph_objects
    '''
choosen_df