controlling over hover column in plotly choropleth map

Viewed 10

I am plotting data using plotly express choropleth function. I am trying to display only top line (variable name = country1) while hovering over the map. enter image description here

trying to eliminate "Remittances (Million USD) 101 to 300" and "iso alpha=USA".

code is given as:

    import plotly.express as px
df = pd.read_csv('remi_top10.csv')

fig = px.choropleth(df, locations="iso_alpha",
                    color='Remittances (Million USD)', # Remittance Received in July 2022
                    hover_name="country1", # column to add to hover information
                    title= "Remittances Received During the Month of July 2022",
                    #color_continuous_scale=px.colors.sequential.Plasma,
                    #color_discrete_sequence= px.colors.sequential.Plasma_r,
                    color_discrete_sequence=["red", "navy", "blue", "goldenrod", "magenta", "purple", "pink", "green"],
                    width=1000,
                    height=550)

fig.update_traces( #hovertemplate=None,
                  # hovertext = '%{country1}',
                    #hoverinfo='skip'     #all, skip, none
                )

fig.update_layout(
    font_family="Courier New",
    font_color="blue",
    title_font_family="Times New Roman",
    title_font_color="green",
    legend_title_font_color="green",
    
    #title_x=0.5 #to center title
                )
fig.update_xaxes(title_font_family="Arial")
fig.show()
0 Answers
Related