Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update imports and func references to support up to latest matplotlib (3.8.3) #450

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

Closed
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
9 changes: 9 additions & 0 deletions WHATSNEW.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,15 @@ Documentation
* Improve colorbar and legend documentation, expound
added features more carefully (:commit:`43631840`).

Version 0.9.8 (2024-03-XX)
==========================

Compatibility
-------------

* Use more flexible reference to ``_cmap_registry`` to support ``matplotlib>=3.6.0`` (:commit:`15a4439`).
* Try multiple import routes to reference ``fontconfig_pattern`` to support up to ``matplotlib==3.8.3`` (:commit:`f003419`).

Version 0.9.5 (2021-10-19)
==========================

Expand Down
6 changes: 6 additions & 0 deletions proplot/axes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,12 @@ def _add_colorbar(
elif isinstance(ticker, mticker.TickHelper):
ticker.set_axis(axis)

if _version_mpl >= '3.6':
print("minorlocator is None, mpl >= 3.6 fix set it to MultipleLocator")
if minorlocator is None:
from matplotlib.ticker import AutoLocator
minorlocator = AutoLocator()

# Create colorbar and update ticks and axis direction
# NOTE: This also adds the guides._update_ticks() monkey patch that triggers
# updates to DiscreteLocator when parent axes is drawn.
Expand Down
8 changes: 6 additions & 2 deletions proplot/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2758,8 +2758,12 @@ def _init_cmap_database():
"""
# WARNING: Skip over the matplotlib native duplicate entries
# with suffixes '_r' and '_shifted'.
attr = '_cmap_registry' if hasattr(mcm, '_cmap_registry') else 'cmap_d'
database = getattr(mcm, attr)
try:
database = mcm._gen_cmap_registry()
attr = '_cmap_registry' # Need to set this for legacy support.
except AttributeError: # older versions that don't have getter for registry.
attr = '_cmap_registry' if hasattr(mcm, '_cmap_registry') else 'cmap_d'
database = getattr(mcm, attr)
if mcm.get_cmap is not _get_cmap:
mcm.get_cmap = _get_cmap
if mcm.register_cmap is not _register_cmap:
Expand Down
8 changes: 6 additions & 2 deletions proplot/internals/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
from matplotlib import rcParamsDefault as _rc_matplotlib_native
from matplotlib.colors import Colormap
from matplotlib.font_manager import font_scalings
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern

try:
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
except ModuleNotFoundError: # 3.8.0 and higher got rid of the public module.
from matplotlib._fontconfig_pattern import parse_fontconfig_pattern

from . import ic # noqa: F401
from . import warnings
Expand Down Expand Up @@ -45,7 +49,7 @@
CYCLE = 'colorblind'
CMAPCYC = 'twilight'
CMAPDIV = 'BuRd'
CMAPSEQ = 'Fire'
CMAPSEQ = 'Viridis'
CMAPCAT = 'colorblind10'
DIVERGING = 'div'
FRAMEALPHA = 0.8 # legend and colorbar
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ project_urls =
[options]
packages = proplot
install_requires =
matplotlib>=3.0.0,<3.6.0
matplotlib>=3.0.0
numpy
include_package_data = True
python_requires = >=3.6.0