Skip to content
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

Remove use of matplotlib's get_offset_position #4372

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [UNRELEASED]

### Fixed
- Repair crash on Matplotlib 3.8 related to get_offset_position [[#4372](https://github.com/plotly/plotly.py/pull/4372)],

## [5.17.0] - 2023-09-15

### Updated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def process_transform(

code = "display"
if ax is not None:
for (c, trans) in [
for c, trans in [
("data", ax.transData),
("axes", ax.transAxes),
("figure", ax.figure.transFigure),
Expand Down Expand Up @@ -130,7 +130,7 @@ def crawl_ax(self, ax):
self.draw_line(ax, line)
for text in ax.texts:
self.draw_text(ax, text)
for (text, ttp) in zip(
for text, ttp in zip(
[ax.xaxis.label, ax.yaxis.label, ax.title],
["xlabel", "ylabel", "title"],
):
Expand Down Expand Up @@ -285,8 +285,14 @@ def draw_collection(
"zorder": collection.get_zorder(),
}

# TODO: When matplotlib's minimum version is bumped to 3.8, this can be
# simplified since collection.get_offset_position no longer exists.
offset_dict = {"data": "before", "screen": "after"}
offset_order = offset_dict[collection.get_offset_position()]
NeilGirdhar marked this conversation as resolved.
Show resolved Hide resolved
offset_order = (
offset_dict[collection.get_offset_position()]
if hasattr(collection, "get_offset_position")
else "after"
)

self.renderer.draw_path_collection(
paths=processed_paths,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pandas==0.24.2
numpy==1.19.5
xarray==0.10.9
statsmodels==0.10.2
pillow==5.2.0
pillow==6.2.0
pytest==3.5.1
pytz==2016.10
ipython[all]==5.4.0
Expand All @@ -15,7 +15,7 @@ scipy==1.2.3
shapely==1.7.0
geopandas==0.3.0
pyshp==1.2.10
matplotlib==2.2.3
matplotlib==3.5.3
scikit-image==0.14.4
psutil==5.7.0
kaleido
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ scipy==1.6.2
Shapely==1.7.1
geopandas==0.9.0
pyshp==2.1.3
matplotlib==2.2.3
matplotlib==3.7.3
scikit-image==0.18.1
psutil==5.7.0
kaleido
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
requests==2.25.1
tenacity==6.2.0
pandas==1.2.4
numpy==1.20.2
numpy==1.21.6
xarray==0.17.0
statsmodels
Pillow==8.2.0
Expand All @@ -15,7 +15,7 @@ scipy==1.6.2
Shapely==1.7.1
geopandas==0.9.0
pyshp==2.1.3
matplotlib==2.2.3
matplotlib==3.8.0
scikit-image==0.18.1
psutil==5.7.0
kaleido
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
requests==2.25.1
tenacity==6.2.0
pandas==2.0.2
numpy==1.20.3
numpy==1.21.6
xarray==0.17.0
statsmodels
Pillow==8.2.0
Expand All @@ -15,7 +15,7 @@ scipy==1.6.2
Shapely==1.7.1
geopandas==0.9.0
pyshp==2.1.3
matplotlib==2.2.3
matplotlib==3.8.0
scikit-image==0.18.1
psutil==5.7.0
kaleido
Expand Down