Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug in AxesStack.add #7194

Closed
Closed
Labels
Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
@brianwa84

Description

@brianwa84

I think I've found a bug where the format of data actually stored in Stack is different from that expected in Stack.remove. It seems that the line below needs to be:
Stack.remove(self, self._entry_from_axes(a_existing))

I don't have a minimal repro case (probably something to do with multi-threading in a tensorflow py_func), but I've been seeing exceptions in the .remove method. Adding some more useful exception messaging shows me a missing self._ind 0th tuple element.

AxesStack.add(((1, 1, 1), ()),..): Axes(0.125,0.1;0.775x0.8) vs Axes(0.125,0.1;0.775x0.8)                         ^key                ^ a                     ^a_existingmatplotlib/cbook.py", line 1410, in remove    raise ValueError('Unknown element o: %s vs %s' % (o, self._elements))Unknown element o: (((1, 1, 1), ()), <matplotlib.axes._subplots.AxesSubplot object at 0x7fd416508550>) vs [(((1, 1, 1), ()), (1, <matplotlib.axes._subplots.AxesSubplot object at 0x7fd416508550>))]    def add(self, key, a):        """        Add Axes *a*, with key *key*, to the stack, and return the stack.        If *a* is already on the stack, don't add it again, but        return *None*.        """        # All the error checking may be unnecessary; but this method        # is called so seldom that the overhead is negligible.        if not isinstance(a, Axes):            raise ValueError("second argument, %s, is not an Axes" % a)        try:            hash(key)        except TypeError:            raise ValueError("first argument, %s, is not a valid key" % key)        a_existing = self.get(key)        if a_existing is not None:HERE-->            Stack.remove(self, (key, a_existing))            warnings.warn(                "key %s already existed; Axes is being replaced" % key)            # I don't think the above should ever happen.        if a in self:            return None        self._ind += 1        return Stack.push(self, (key, (self._ind, a)))

To help us understand and resolve your issue please check that you have provided
the information below.

  • Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
  • How did you install Matplotlib and Python (pip, anaconda, from source ...)
  • If possible please supply aShort, Self Contained, Correct, Example
    that demonstrates the issue i.e a small piece of code which reproduces the issue
    and can be run with out any other (or as few as possible) external dependencies.
  • If this is an image generation bug attach a screenshot demonstrating the issue.
  • If this is a regression (Used to work in an earlier version of Matplotlib), please
    note where it used to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp