plotting.py
def new_listing_fig(choosen_df):
    '''
    Make fugure compare New Listings and Closed Sales
    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]["New Listings"],
                name=m,
                text=m,
                textposition="inside",
                insidetextanchor="start",
                offsetgroup=m,
                hovertemplate="<br>New Listings: %{y}",
                marker_color=color,
                showlegend=False,
                opacity=0.8,
            )
        )
        fig.add_trace(
            go.Bar(
                x=choosen_df["Month"],
                y=choosen_df[choosen_df["Year"] == m]["Closed Sales"],
                name=m,
                text=m,
                textposition="inside",
                insidetextanchor="start",
                offsetgroup=m,
                hovertemplate="<br>Closed Sales: %{y}",
                marker_color=color,
                showlegend=False,
                opacity=0.7,
            )
        )

    fig.update_layout(
        title={
            "text": "New Listings vs Closed Sales",
            "y": 0.9,
            "x": 0.5,
            "xanchor": "center",
            "yanchor": "top",
        },
        yaxis_title="Sales",
    )
    return fig

    Make fugure compare New Listings and Closed Sales
    INPUT: dataframe
    OUTPUT: figure, plotly.graph_objects
    
Make fugure compare New Listings and Closed Sales
INPUT: dataframe
OUTPUT: figure, plotly.graph_objects
Make fugure compare New Listings and Closed Sales INPUT : dataframe OUTPUT : figure plotly . graph_objects
def new_listing_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]["New Listings"],
                name=m,
                text=m,
                textposition="inside",
                insidetextanchor="start",
                offsetgroup=m,
                hovertemplate="<br>New Listings: %{y}",
                marker_color=color,
                showlegend=False,
                opacity=0.8,
            )
        )
        fig.add_trace(
            go.Bar(
                x=choosen_df["Month"],
                y=choosen_df[choosen_df["Year"] == m]["Closed Sales"],
                name=m,
                text=m,
                textposition="inside",
                insidetextanchor="start",
                offsetgroup=m,
                hovertemplate="<br>Closed Sales: %{y}",
                marker_color=color,
                showlegend=False,
                opacity=0.7,
            )
        )
    fig.update_layout(
        title={
            "text": "New Listings vs Closed Sales",
            "y": 0.9,
            "x": 0.5,
            "xanchor": "center",
            "yanchor": "top",
        },
        yaxis_title="Sales",
    )
    return fig
def new_listing_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 ] [ "New Listings" ] , name = m , text = m , textposition = "inside" , insidetextanchor = "start" , offsetgroup = m , hovertemplate = "<br>New Listings: %{y}" , marker_color = color , showlegend = False , opacity = 0.8 , ) ) fig . add_trace ( go . Bar ( x = choosen_df [ "Month" ] , y = choosen_df [ choosen_df [ "Year" ] == m ] [ "Closed Sales" ] , name = m , text = m , textposition = "inside" , insidetextanchor = "start" , offsetgroup = m , hovertemplate = "<br>Closed Sales: %{y}" , marker_color = color , showlegend = False , opacity = 0.7 , ) ) fig . update_layout ( title = { "text" : "New Listings vs Closed Sales" , "y" : 0.9 , "x" : 0.5 , "xanchor" : "center" , "yanchor" : "top" , } , yaxis_title = "Sales" , ) return fig
Make fugure compare New Listings and Closed Sales
INPUT: dataframe
OUTPUT: figure, plotly.graph_objects
Make fugure compare New Listings and Closed Sales INPUT : dataframe OUTPUT : figure plotly . graph_objects
'''
    Make fugure compare New Listings and Closed Sales
    INPUT: dataframe
    OUTPUT: figure, plotly.graph_objects
    '''
choosen_df