Skip to content

Commit

Permalink
matplotlib 3.7 fails - MarkerStyle (#1113)
Browse files Browse the repository at this point in the history
this single change allows qiskit_experiments to work for matplotlib 3.7

```
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/__init__.py:68: in <module>
    from . import library
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/library/__init__.py:116: in <module>
    from .calibration import (
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/library/calibration/__init__.py:62: in <module>
    from .rough_frequency import RoughFrequencyCal
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/library/calibration/rough_frequency.py:20: in <module>
    from qiskit_experiments.library.characterization.qubit_spectroscopy import QubitSpectroscopy
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/library/characterization/__init__.py:79: in <module>
    from .analysis import (
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/library/characterization/analysis/__init__.py:15: in <module>
    from .drag_analysis import DragCalAnalysis
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/library/characterization/analysis/drag_analysis.py:20: in <module>
    import qiskit_experiments.curve_analysis as curve
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/curve_analysis/__init__.py:553: in <module>
    from .base_curve_analysis import BaseCurveAnalysis
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/curve_analysis/base_curve_analysis.py:31: in <module>
    from qiskit_experiments.visualization import (
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/visualization/__init__.py:71: in <module>
    from .drawers import BaseDrawer, LegacyCurveCompatDrawer, MplDrawer
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/visualization/drawers/__init__.py:15: in <module>
    from .legacy_curve_compat_drawer import LegacyCurveCompatDrawer
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/visualization/drawers/legacy_curve_compat_drawer.py:20: in <module>
    from qiskit_experiments.curve_analysis.visualization import BaseCurveDrawer
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/curve_analysis/visualization/__init__.py:25: in <module>
    from .mpl_drawer import MplCurveDrawer
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/curve_analysis/visualization/mpl_drawer.py:36: in <module>
    class MplCurveDrawer(BaseCurveDrawer):
venvs/s/581f024a/venv/lib/python3.9/site-packages/qiskit_experiments/curve_analysis/visualization/mpl_drawer.py:39: in MplCurveDrawer
    DefaultMarkers = MarkerStyle().filled_markers
venvs/s/581f024a/venv/lib/python3.9/site-packages/matplotlib/markers.py:261: in __init__
    _api.warn_deprecated(
venvs/s/581f024a/venv/lib/python3.9/site-packages/matplotlib/_api/deprecation.py:96: in warn_deprecated
    warn_external(warning, category=MatplotlibDeprecationWarning)
venvs/s/581f024a/venv/lib/python3.9/site-packages/matplotlib/_api/__init__.py:388: in warn_external
    warnings.warn(message, category, stacklevel)
E   matplotlib._api.deprecation.MatplotlibDeprecationWarning: Calling MarkerStyle() with no parameters is deprecated since 3.6; support will be removed two minor releases later.  Use MarkerStyle('') to construct an empty MarkerStyle.
```

### Summary

matplotlib API changes in 3.7

### Details and comments

Some details that should be in this section include:

qiskit_experiments has a warning if this change it not made.

- E matplotlib._api.deprecation.MatplotlibDeprecationWarning: Calling
MarkerStyle() with no parameters is deprecated since 3.6; support will
be removed two minor releases later. Use MarkerStyle('') to construct an
empty MarkerStyle.


### PR checklist (delete when all criteria are met)

- [X] I have read the contributing guide `CONTRIBUTING.md`.
- [X] I have added the tests to cover my changes.
- [X] I have updated the documentation accordingly.
- [X] I have added a release note file using `reno` if this change needs
to be documented in the release notes.

---------

Co-authored-by: Helena Zhang <hadron.diaspora@gmail.com>
Co-authored-by: Ian Hincks <ian.hincks@gmail.com>
Co-authored-by: Helena Zhang <helena.zhang@ibm.com>
  • Loading branch information
4 people authored Apr 17, 2023
1 parent b05dc3d commit 7a1fb78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
class MplCurveDrawer(BaseCurveDrawer):
"""Curve drawer for MatplotLib backend."""

DefaultMarkers = MarkerStyle().filled_markers
DefaultMarkers = MarkerStyle.filled_markers
DefaultColors = tab10.colors

class PrefixFormatter(Formatter):
Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/matplotlib-fix-58d938b49771cf17.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
Fixed a deprecated Matplotlib ``MarkerStyle`` usage in the visualization module that was causing warnings in Matplotlib 3.6+.

0 comments on commit 7a1fb78

Please sign in to comment.