hi,
Is there any way to change default color of bubbles in this code
px.scatter_geo(df_row, lat=“lat”,lon=“long”,
hover_name=“country”, size=“count”,
animation_frame=“hour”,
projection=“natural earth”)
with this code i am getting blue color but i want red color to all the bubbles
Hi @jahnavi14
You have to use color property to set the color of the bubbles in the plot. For this to happen, you need to assign a column in the dataframe to define the colors.
Hence, you can add df_row["Colors"] = "red"
In the main code,
px.scatter_geo(df_row,
lat=“lat”,
lon=“long”,
hover_name=“country”,
size=“count”,
animation_frame=“hour”,
color = “Colors”,
color_discrete_map={
"red": "#EF553B"
},
projection=“natural earth”)
Despite assigning a categorical variable in our dataframe, you might not get red as the default color. Hence, color_discrete_map is used to assign the value red to a Hexcolor code to get the result you want.
Thanks. I tried and color is changed
1 Like