Skip to content

Commit

Permalink
Minor bugfixes - incl. for pathcollection contours
Browse files Browse the repository at this point in the history
  • Loading branch information
morganjwilliams committed Nov 11, 2022
1 parent c097a41 commit f48f1a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions pyrolite/util/plot/axes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Functions for creating, ordering and modifying :class:`~matplolib.axes.Axes`.
"""
import warnings

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
Expand Down
12 changes: 7 additions & 5 deletions pyrolite/util/plot/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,17 @@ def get_contour_paths(ax, resolution=100):
linecolls = [
c
for c in ax.collections
if isinstance(c, matplotlib.collections.LineCollection)
# contours/default lines don't have markers - allows distinguishing scatter
if isinstance(c, matplotlib.collections.PathCollection)
and c.get_sizes().size == 0
]
rgba = [[int(c) for c in lc.get_edgecolors().flatten() * 255] for lc in linecolls]
rgba = [lc.get_edgecolors() for lc in linecolls]
styles = [{"color": c} for c in rgba]
names = [None for lc in linecolls]
if (len(ax.artists) == len(linecolls)) and all(
[a.get_text() != "" for a in ax.artists]
if (len(ax.texts) == len(linecolls)) and all(
[a.get_text() != "" for a in ax.texts]
):
names = [a.get_text() for a in ax.artists]
names = [a.get_text() for a in ax.texts]
return (
[
[
Expand Down

0 comments on commit f48f1a4

Please sign in to comment.