Skip to content

Commit

Permalink
Merge pull request #5371 from QCoDeS/dependabot/pip/matplotlib-approx…
Browse files Browse the repository at this point in the history
…-eq-3.8.0

Update matplotlib requirement from ~=3.7.0 to ~=3.8.0
  • Loading branch information
jenshnielsen committed Sep 16, 2023
2 parents 45067e4 + 2946729 commit 0e9a911
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ module = [
"gclib",
"ipywidgets",
"h5netcdf",
"matplotlib.*",
"mcl_RF_Switch_Controller64",
"mcl_RF_Switch_Controller_NET45",
"opencensus.ext.azure.*",
Expand Down
2 changes: 1 addition & 1 deletion qcodes/dataset/dond/do_nd_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
]
MultiAxesTupleListWithDataSet = tuple[
tuple[DataSetProtocol, ...],
tuple[tuple["matplotlib.axes.Axes", ...], ...],
tuple[tuple[Optional["matplotlib.axes.Axes"], ...], ...],
tuple[tuple[Optional["matplotlib.colorbar.Colorbar"], ...], ...],
]

Expand Down
8 changes: 7 additions & 1 deletion qcodes/dataset/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from typing import TYPE_CHECKING, Any, Literal, Optional, cast

import numpy as np
from matplotlib.figure import Figure

if TYPE_CHECKING:
import matplotlib
Expand Down Expand Up @@ -350,6 +351,7 @@ def plot_and_save_image(
os.makedirs(png_dir, exist_ok=True)
os.makedirs(pdf_dif, exist_ok=True)
for i, ax in enumerate(axes):
assert isinstance(ax.figure, Figure)
if save_pdf:
full_path = os.path.join(pdf_dif, f"{dataid}_{i}.pdf")
ax.figure.savefig(full_path, dpi=500, bbox_inches="tight")
Expand Down Expand Up @@ -591,8 +593,11 @@ def plot_2d_scatterplot(
name = getattr(cmap, "name", _DEFAULT_COLORMAP)
cmap = matplotlib.cm.get_cmap(name, len(z_strings))

mappable = ax.scatter(x=x, y=y, c=z, rasterized=rasterized, cmap=cmap, **kwargs)
# according to the docs the c argument should support an ndarray
# but that fails type checking
mappable = ax.scatter(x=x, y=y, c=z, rasterized=rasterized, cmap=cmap, **kwargs) # type: ignore[arg-type]

assert ax.figure is not None
if colorbar is not None:
colorbar = ax.figure.colorbar(mappable, ax=ax, cax=colorbar.ax)
else:
Expand Down Expand Up @@ -705,6 +710,7 @@ def plot_on_a_plain_grid(
ax.set_yticks(np.arange(len(np.unique(y_strings))))
ax.set_yticklabels(y_strings)

assert ax.figure is not None
if colorbar is not None:
colorbar = ax.figure.colorbar(colormesh, ax=ax, cax=colorbar.ax)
else:
Expand Down
2 changes: 1 addition & 1 deletion qcodes/plotting/matplotlib_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _set_colorbar_extend(
"min": slice(1, None),
"max": slice(0, -1),
}
colorbar._inside = _slice_dict[extend] # pyright: ignore[reportGeneralTypeIssues]
colorbar._inside = _slice_dict[extend] # type: ignore[attr-defined]


def apply_color_scale_limits(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ kiwisolver~=1.4.4
lazy_loader==0.3
lxml~=4.9.1
MarkupSafe~=2.1.1
matplotlib~=3.7.0
matplotlib~=3.8.0
matplotlib-inline==0.1.6
mistune~=3.0.1
msal~=1.24.0
Expand Down

0 comments on commit 0e9a911

Please sign in to comment.