Skip to content

Commit

Permalink
Merge pull request #478 from LDAP/bugfix/indexerror
Browse files Browse the repository at this point in the history
Fix IndexError (#474)
  • Loading branch information
nschloe committed Apr 8, 2021
2 parents 3c97861 + 32e6151 commit dc919b3
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions tikzplotlib/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,22 @@ def draw_pathcollection(data, obj):

# "solution" from
# <https://github.com/matplotlib/matplotlib/issues/4672#issuecomment-378702670>
p = obj.get_paths()[0]
ms = {style: MarkerStyle(style) for style in MarkerStyle.markers}
paths = {
style: marker.get_path().transformed(marker.get_transform())
for style, marker in ms.items()
}
marker0 = None
for marker, path in paths.items():
if (
np.array_equal(path.codes, p.codes)
and (path.vertices.shape == p.vertices.shape)
and np.max(np.abs(path.vertices - p.vertices)) < 1.0e-10
):
marker0 = marker
break
if obj.get_paths():
p = obj.get_paths()[0]
ms = {style: MarkerStyle(style) for style in MarkerStyle.markers}
paths = {
style: marker.get_path().transformed(marker.get_transform())
for style, marker in ms.items()
}
for marker, path in paths.items():
if (
np.array_equal(path.codes, p.codes)
and (path.vertices.shape == p.vertices.shape)
and np.max(np.abs(path.vertices - p.vertices)) < 1.0e-10
):
marker0 = marker
break

is_contour = len(dd) == 1
if is_contour:
Expand Down

0 comments on commit dc919b3

Please sign in to comment.