-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new traces: scattermap
, choroplethmap
and densitymap
which use maplibre
to render maps
#7060
Conversation
This reverts commit a136a89.
'Defines the map layers that are rendered by default below the trace layers defined in `data`,', | ||
'which are themselves by default rendered below the layers defined in `layout.map.layers`.', | ||
'', | ||
'These layers can be defined either explicitly as a Map Style object which can contain multiple', | ||
'layer definitions that load data from any public or private Tile Map Service (TMS or XYZ) or Web Map Service (WMS)', | ||
'or implicitly by using one of the built-in style objects which use WMSes', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@birkskyum I was wondering about this: "map layers that are rendered by default below the trace layers defined in data
"
When testing the following example out on the Python side:
import pandas as pd
import plotly.graph_objects as go
quakes = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/earthquakes-23k.csv')
fig = go.Figure(go.Densitymap(lat=quakes.Latitude, lon=quakes.Longitude, z=quakes.Magnitude, radius=10))
fig.update_layout(
map={
"style": "carto-darkmatter",
"center": {"lon": 180},
},
margin={"r": 0, "t": 0, "l": 0, "b": 0}
)
fig.show()
I see this, where it looks like the text is above the data. Is that expected.
The previous implementation looked like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When adding a layer to mapbox/maplibre, it's possible to specify which layer in the style it should sit below - this is thus dependent on which style is used. In this case, with the carto dark matter style, that setting should likely be 'waterway_label' to give the expected outcome. The primary tool used to examine the individual layers of a style.json, and make new styles, is Maputnik.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally like this new look; but we should possibly try to make the maplibre version look similar to the mapbox one. @birkskyum Do you know what may change in the mock or code to make that happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I see the instruction here: https://docs.carto.com/carto-for-developers/carto-for-react/guides/basemaps#carto-custom-basemap
cc: @LiamConnors
@ndrezn @emilykl |
Not sure if this was resolved but I agree that the desirable default is no attribution. @birkskyum do you have any thoughts on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. 👍 🌟 💫
The icon in the lower left corner is entirely optional, so if it's preferable to the product to leave it out, then that seems like the right thing to do. Like with other BSD/MIT/Apache licensed software, the only ask is really to retain/reproduce the copyright notice somewhere, but apart from that the only concern is what's best for the end-user. In the case of plotly.js, where each graph typically is rather small, and there are often multiple graphs, then the icon takes up more space / makes more noise than i.e. a full screen app like https://maps.bing.com (they also opted not to show the icon, but it would have taken up relatively less space). The style/data attribution text/toggle (lower right) is dependent on the style provider, so it's probably a good idea to keep that around. |
@birkskyum @alexcjohnson |
Supersedes #7015.
Thanks to @birkskyum's PR, I kept mapbox traces and added new traces i.e.
scattermap
,choroplethmap
anddensitymap
to the API.These traces use
map
,map2
, etc. on thelayout
and do not require aconfig
parameter as they use maplibre-gl.@plotly/plotly_js