Black Lives Matter. Please consider donating to Black Girls Code today.

Scattermapbox with scaling

I have a dataframe with lat long and value with more than 25 data in it, i want to plot them in a scattermapbox with colors from a scale which should be visible on the right side. How does a scaling works here, does it pick value automatically from a column. Any examples will be useful

Hi @rasika, this example creates a scattermapbox using a different column for the size and for the color of markers. Is this what you’re looking for?

Let me try and comeback to you. Thanks for the reply

@Emmanuelle in that example, i dont understand from where the dataframe is coming from, specifically this line
df = px.data.carshare(). How do i use my own df in plotly.express

I realised that the plotly.express is some kind of online version, which never worked for me, can you please tell me how can i get this done in offline mode.

Hi @rasika, starting from plotly 4.0 there is no offline / online for plotly.py (see https://medium.com/plotly/plotly-py-4-0-is-here-offline-only-express-first-displayable-anywhere-fc444e5659ee), ie all your figures are rendered locally. Please make sure to have a recent enough version of plotly (>=4.1, the current version is 4.6) since the documentation corresponds to versions >= 4.1,

You can pass your own dataframes to plotly.express functions, and pass column names from your dataframe as arguments. Please read the plotly express tutorial to get started with plotly express.

:scream: :weary: I dont understand plotly express at all, from the start. I only have plotly offline so, i should be migrating all these?
And in the below code

import plotly.express as px
df = px.data.iris() # iris is a pandas DataFrame
fig = px.scatter(df, x="sepal_width", y="sepal_length")
fig.show()

what is px.data.iris() how did that come up all of a sudden. I dont understand this, sorry.

I got this working, thanks @Emmanuelle for your responses.