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

Fix MarkerStyle for matplotlib compatibility #1113

Merged
merged 4 commits into from
Apr 17, 2023

Conversation

rbuckland
Copy link
Contributor

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)

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

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.
```
@CLAassistant
Copy link

CLAassistant commented Mar 29, 2023

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@ihincks
Copy link
Contributor

ihincks commented Apr 5, 2023

I closed a competing PR (#1130) in favour of just pushing this one through (@coruscating).
Here's a patch for a release note if you want it:

diff --git a/releasenotes/notes/mpl-36-markerstyle-c6b51652b08991a5.yaml b/releasenotes/notes/mpl-36-markerstyle-c6b51652b08991a5.yaml
new file mode 100644
index 0000000..eeb5e8e
--- /dev/null
+++ b/releasenotes/notes/mpl-36-markerstyle-c6b51652b08991a5.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Removed no-argument construction of `matplotlib.markers.MarkerStyle` for
+    [compatibility with matplotlib>=3.6](https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.6.0.html#positional-keyword-arguments).

@coruscating
Copy link
Collaborator

@rbuckland Thanks for contributing. Can you sign the CLA?

@rbuckland
Copy link
Contributor Author

Done

@coruscating
Copy link
Collaborator

@rbuckland What do you think about the proposed change? We'd like to include this in the next bug fix release in the next week or two, and if you can write a short release note describing the fix, that would be great.

@coruscating
Copy link
Collaborator

@rbuckland Unless you have objections, I will update this PR with @ihincks's proposed changes and the release note.

@coruscating coruscating added backport stable potential The issue or PR might be minimal and/or import enough to backport to stable Changelog: Bugfix Include in the "Fixed" section of the changelog labels Apr 17, 2023
@coruscating coruscating added this pull request to the merge queue Apr 17, 2023
@coruscating coruscating changed the title matplotlib 3.7 fails - MarkerStyle Fix MarkerStyle for matplotlib compatibility Apr 17, 2023
Merged via the queue into qiskit-community:main with commit 7a1fb78 Apr 17, 2023
mergify bot pushed a commit that referenced this pull request Apr 17, 2023
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>
(cherry picked from commit 7a1fb78)
coruscating pushed a commit that referenced this pull request Apr 17, 2023
This is an automatic backport of pull request #1113 done by
[Mergify](https://mergify.com).

Co-authored-by: Ramon Buckland <rbuckland@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable potential The issue or PR might be minimal and/or import enough to backport to stable Changelog: Bugfix Include in the "Fixed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants