forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compatibility with Matplotlib 3.5 (Qiskit#7301)
* Fix compatibility with Matplotlib 3.5 The problem was `qiskit.visualization.bloch.Arrow3D`, which subclassed `matplotlib.patches.FancyArrowPatch` (a 2D patch), but not the 3D machinery. It is now made an unholy multiple-inherited abomination of both the 2D patch and `mpl_toolkits.mplot3d.art3d.Patch3D`; the latter is a relatively thin wrapper (in terms of attributes) around the 2D patch, so this is not too terrible. Matplotlib 3.5 calls the `Patch3D.do_3d_projection` method using a deprecated parameter, triggering two warnings, unless the artist's module appears to have come from `mpl_toolkits.mplot3d.art3d`, even if the new calling convention is respected. The warning is only triggered when the figure is drawn, which may well be outside of our control, so we cannot suppress the warnings. Instead, we just lie about the module the arrow patch was defined in, to trick it into not warning, because we use the new calling convention. This is supported at least as far back as Matplotlib 3.3, which is the current minimum supported version. The nasty hack should be removable once Matplotlib 3.6 is the minimum version because the deprecation period will expire. * Remove useless word Co-authored-by: Matthew Treinish <[email protected]> Co-authored-by: Matthew Treinish <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f6b6395
commit ba8e3f3
Showing
5 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fixes: | ||
- | | ||
Fixed a compatibility issue with Matplotlib 3.5, where the Bloch sphere would fail to render if it had any vectors attached, such as by using :obj:`~qiskit.visualization.plot_bloch_vector`. | ||
See `#7272 <https://github.com/Qiskit/qiskit-terra/issues/7272>`__ for more detail. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters