Skip to content

ValueError when specifying marker vertices #7807

@lkilcher

Description

@lkilcher

Bug report

When specifying a marker as a numpy array of 3 or fewer vertices (e.g. a line-segment marker), a ValueError is raised.

Code for reproduction

    import numpy as np
    import matplotlib.pyplot as plt
    
    mrk_array = np.array([[-0.5, 0],
                          [0.5, 0]])

    plt.plot(0, 0, marker=mrk_array)
/Library/Python/2.7/site-packages/matplotlib/markers.pyc in set_marker(self, marker)
    233     def set_marker(self, marker):
    234         if (iterable(marker) and len(marker) in (2, 3) and
--> 235                 marker[1] in (0, 1, 2, 3)):
    236             self._marker_function = self._set_tuple_marker
    237         elif isinstance(marker, np.ndarray):

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I'm getting this both for MPL v1.5.3, and HEAD of master. I think this should be as simple as moving the isinstance(marker, np.ndarray) check to come first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy