Skip to content

Commit

Permalink
Merge pull request #6077 from microsoft/dependabot/pip/matplotlib-3.9.0
Browse files Browse the repository at this point in the history
Bump matplotlib from 3.8.4 to 3.9.0
  • Loading branch information
jenshnielsen committed May 16, 2024
2 parents 3c0bedd + 5f1f6e1 commit d1b69cf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
7 changes: 3 additions & 4 deletions docs/examples/DataSet/Offline Plotting Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"%matplotlib inline\n",
"from pathlib import Path\n",
"\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
Expand Down Expand Up @@ -490,9 +491,7 @@
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"cmap = plt.get_cmap('hot')\n",
"cmap = matplotlib.colormaps.get_cmap(\"hot\")\n",
"axes, colorbars = plot_dataset(dataset, cmap=cmap)"
]
},
Expand Down Expand Up @@ -978,7 +977,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.12.3"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ markupsafe==2.1.5
# via
# jinja2
# nbconvert
matplotlib==3.8.4
matplotlib==3.9.0
# via
# broadbean
# qcodes
Expand Down
14 changes: 8 additions & 6 deletions src/qcodes/dataset/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This plotting module provides various functions to plot the data measured
using QCoDeS.
"""

from __future__ import annotations

import inspect
Expand Down Expand Up @@ -236,7 +237,6 @@ def plot_dataset(
new_colorbars: list[Colorbar | None] = []

for data, ax, colorbar in zip(alldata, axeslist, colorbars):

if len(data) == 2: # 1D PLOTTING
log.debug(f"Doing a 1D plot with kwargs: {kwargs}")

Expand Down Expand Up @@ -330,7 +330,11 @@ def plot_dataset(

def plot_and_save_image(
data: DataSetProtocol, save_pdf: bool = True, save_png: bool = True
) -> tuple[DataSetProtocol, tuple[Axes, ...], tuple[Colorbar | None, ...],]:
) -> tuple[
DataSetProtocol,
tuple[Axes, ...],
tuple[Colorbar | None, ...],
]:
"""
The utility function to plot results and save the figures either in pdf or
png or both formats.
Expand Down Expand Up @@ -578,7 +582,6 @@ def plot_2d_scatterplot(
The matplotlib axis handles for plot and colorbar
"""
import matplotlib
import matplotlib.cm

if "rasterized" in kwargs.keys():
rasterized = kwargs.pop("rasterized")
Expand All @@ -597,7 +600,7 @@ def plot_2d_scatterplot(

if z_is_stringy:
name = getattr(cmap, "name", _DEFAULT_COLORMAP)
cmap = matplotlib.cm.get_cmap(name, len(z_strings))
cmap = matplotlib.colormaps.get_cmap(name).resampled(len(z_strings))

# according to the docs the c argument should support an ndarray
# but that fails type checking
Expand Down Expand Up @@ -649,7 +652,6 @@ def plot_on_a_plain_grid(
The matplotlib axes handle for plot and colorbar
"""
import matplotlib
import matplotlib.cm

log.debug(f"Got kwargs: {kwargs}")

Expand Down Expand Up @@ -698,7 +700,7 @@ def plot_on_a_plain_grid(

if z_is_stringy:
name = getattr(cmap, "name", _DEFAULT_COLORMAP)
cmap = matplotlib.cm.get_cmap(name, len(z_strings))
cmap = matplotlib.colormaps.get_cmap(name).resampled(len(z_strings))

colormesh = ax.pcolormesh(
x_to_plot,
Expand Down

0 comments on commit d1b69cf

Please sign in to comment.