Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/probeinterface/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,23 +252,25 @@ def plot_probegroup(probegroup, same_axes: bool = True, **kargs):

import matplotlib.pyplot as plt

figsize = kargs.pop("figsize", None)

@alejoe91 alejoe91 May 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that pop fails if figsize is not in the dict. Can you use get instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you're passing the None, so this works!


n = len(probegroup.probes)

if same_axes:
if "ax" in kargs:
ax = kargs.pop("ax")
else:
if probegroup.ndim == 2:
fig, ax = plt.subplots()
fig, ax = plt.subplots(figsize=figsize)
else:
fig = plt.figure()
fig = plt.figure(figsize=figsize)
ax = fig.add_subplot(1, 1, 1, projection="3d")
axs = [ax] * n
else:
if "ax" in kargs:
raise ValueError("when same_axes=False, an axes object cannot be passed into this function.")
if probegroup.ndim == 2:
fig, axs = plt.subplots(ncols=n, nrows=1)
fig, axs = plt.subplots(ncols=n, nrows=1, figsize=figsize)
if n == 1:
axs = [axs]
else:
Expand Down