Skip to content

Commit

Permalink
use matplotlib legend_handles instead of deprecated legendHandles (#51)
Browse files Browse the repository at this point in the history
* use matplotlib legend_handles instead of deprecated legendHandles

* update lock file
  • Loading branch information
kjohnsen authored Jun 4, 2024
1 parent 8c7ca57 commit b29eecb
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 36 deletions.
2 changes: 1 addition & 1 deletion cleo/ephys/probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def add_self_to_plot(
label=self.name,
depthshade=False,
)
handles = ax.get_legend().legendHandles
handles = ax.get_legend().legend_handles
handles.append(markers)
ax.legend(handles=handles)
return [markers]
Expand Down
2 changes: 1 addition & 1 deletion cleo/imaging/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def add_self_to_plot(
color_rgba[:, :3] = 0.3 * color_rgba[:, :3]
target_markers.set(color=color_rgba)

handles = ax.get_legend().legendHandles
handles = ax.get_legend().legend_handles
handles.append(target_markers)
patch = mpl.patches.Patch(color=color, label=self.name)
handles.append(patch)
Expand Down
2 changes: 1 addition & 1 deletion cleo/light/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def add_self_to_plot(self, ax, axis_scale_unit, **kwargs) -> list[PathCollection
point_cloud.set_rasterized(kwargs.get("rasterized", True))
point_clouds.append(point_cloud)

handles = ax.get_legend().legendHandles
handles = ax.get_legend().legend_handles
c = wavelength_to_rgb(self.wavelength / nmeter)
opto_patch = mpl.patches.Patch(color=c, label=self.name)
handles.append(opto_patch)
Expand Down
66 changes: 35 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cleosim"
version = "0.14.3"
version = "0.14.4"
description = "Cleo: the Closed-Loop, Electrophysiology, and Optogenetics experiment simulation testbed"
authors = [
"Kyle Johnsen <[email protected]>",
Expand All @@ -20,7 +20,7 @@ packages = [{ include = "cleo" }]
[tool.poetry.dependencies]
python = ">=3.9,<3.13"
brian2 = "^2.4, !=2.5.0.2"
matplotlib = "^3.4"
matplotlib = "^3.7"
numpy = "^1.16"
scipy = "^1.7.2"
tklfp = "^0.2"
Expand Down

0 comments on commit b29eecb

Please sign in to comment.