Skip to content

[pull] master from plotly:master #154

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

Merged
merged 9 commits into from
Nov 25, 2024
23 changes: 23 additions & 0 deletions packages/python/plotly/codegen/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
from codegen.utils import PlotlyNode, write_source_py


deprecated_mapbox_traces = [
"scattermapbox",
"choroplethmapbox",
"densitymapbox",
]


def get_typing_type(plotly_type, array_ok=False):
"""
Get Python type corresponding to a valType string from the plotly schema
Expand Down Expand Up @@ -95,6 +102,9 @@ def build_datatype_py(node):
)
buffer.write(f"import copy as _copy\n")

if node.name_property in deprecated_mapbox_traces:
buffer.write(f"from warnings import warn\n")

# Write class definition
# ----------------------
buffer.write(
Expand Down Expand Up @@ -400,6 +410,19 @@ def __init__(self"""
"""
)

if node.name_property in deprecated_mapbox_traces:
buffer.write(
f"""
warn(
"*{node.name_property}* is deprecated!"
+ " Use *{node.name_property.replace("mapbox", "map")}* instead."
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",
stacklevel=2,
category=DeprecationWarning,
)
"""
)

# Return source string
# --------------------
return buffer.getvalue()
Expand Down
38 changes: 38 additions & 0 deletions packages/python/plotly/plotly/express/_chart_types.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from warnings import warn

from ._core import make_figure
from ._doc import make_docstring
import plotly.graph_objs as go
Expand Down Expand Up @@ -1415,9 +1417,18 @@ def scatter_mapbox(
height=None,
) -> go.Figure:
"""
*scatter_mapbox* is deprecated! Use *scatter_map* instead.
Learn more at: https://plotly.com/python/mapbox-to-maplibre/
In a Mapbox scatter plot, each row of `data_frame` is represented by a
symbol mark on a Mapbox map.
"""
warn(
"*scatter_mapbox* is deprecated!"
+ " Use *scatter_map* instead."
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",
stacklevel=2,
category=DeprecationWarning,
)
return make_figure(args=locals(), constructor=go.Scattermapbox)


Expand Down Expand Up @@ -1453,9 +1464,18 @@ def choropleth_mapbox(
height=None,
) -> go.Figure:
"""
*choropleth_mapbox* is deprecated! Use *choropleth_map* instead.
Learn more at: https://plotly.com/python/mapbox-to-maplibre/
In a Mapbox choropleth map, each row of `data_frame` is represented by a
colored region on a Mapbox map.
"""
warn(
"*choropleth_mapbox* is deprecated!"
+ " Use *choropleth_map* instead."
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",
stacklevel=2,
category=DeprecationWarning,
)
return make_figure(args=locals(), constructor=go.Choroplethmapbox)


Expand Down Expand Up @@ -1489,9 +1509,18 @@ def density_mapbox(
height=None,
) -> go.Figure:
"""
*density_mapbox* is deprecated! Use *density_map* instead.
Learn more at: https://plotly.com/python/mapbox-to-maplibre/
In a Mapbox density map, each row of `data_frame` contributes to the intensity of
the color of the region around the corresponding point on the map
"""
warn(
"*density_mapbox* is deprecated!"
+ " Use *density_map* instead."
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",
stacklevel=2,
category=DeprecationWarning,
)
return make_figure(
args=locals(), constructor=go.Densitymapbox, trace_patch=dict(radius=radius)
)
Expand Down Expand Up @@ -1526,9 +1555,18 @@ def line_mapbox(
height=None,
) -> go.Figure:
"""
*line_mapbox* is deprecated! Use *line_map* instead.
Learn more at: https://plotly.com/python/mapbox-to-maplibre/
In a Mapbox line plot, each row of `data_frame` is represented as
a vertex of a polyline mark on a Mapbox map.
"""
warn(
"*line_mapbox* is deprecated!"
+ " Use *line_map* instead."
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",
stacklevel=2,
category=DeprecationWarning,
)
return make_figure(args=locals(), constructor=go.Scattermapbox)


Expand Down
9 changes: 9 additions & 0 deletions packages/python/plotly/plotly/graph_objs/_choroplethmapbox.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
from warnings import warn


class Choroplethmapbox(_BaseTraceType):
Expand Down Expand Up @@ -2378,3 +2379,11 @@ def __init__(
# Reset skip_invalid
# ------------------
self._skip_invalid = False

warn(
"*choroplethmapbox* is deprecated!"
+ " Use *choroplethmap* instead."
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",
stacklevel=2,
category=DeprecationWarning,
)
9 changes: 9 additions & 0 deletions packages/python/plotly/plotly/graph_objs/_densitymapbox.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
from warnings import warn


class Densitymapbox(_BaseTraceType):
Expand Down Expand Up @@ -2319,3 +2320,11 @@ def __init__(
# Reset skip_invalid
# ------------------
self._skip_invalid = False

warn(
"*densitymapbox* is deprecated!"
+ " Use *densitymap* instead."
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",
stacklevel=2,
category=DeprecationWarning,
)
9 changes: 9 additions & 0 deletions packages/python/plotly/plotly/graph_objs/_scattermapbox.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
from warnings import warn


class Scattermapbox(_BaseTraceType):
Expand Down Expand Up @@ -2292,3 +2293,11 @@ def __init__(
# Reset skip_invalid
# ------------------
self._skip_invalid = False

warn(
"*scattermapbox* is deprecated!"
+ " Use *scattermap* instead."
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",
stacklevel=2,
category=DeprecationWarning,
)