Skip to content

Scatter3D: depthshade=False causes IndexError for Tkinter when plotting more than one point. #18037

Closed
@okkevaneck

Description

@okkevaneck

Bug report

Bug summary

Setting depthshade=False causes an IndexError for Tkinter when plotting more than one point. There are no errors when plotting one point.

Code for reproduction

    fig = plt.figure()
    ax = fig.gca(projection="3d")
    ax.scatter([0,1], [0,1], [0,1], c="royalblue", marker="o",
                depthshade=False, s=60, label="H")
    plt.show()

Actual outcome

I'll only post the first and last rows of the terminal, as the rest contains privacy sensitive information.

First rows:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.6/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/usr/lib/python3.6/tkinter/__init__.py", line 749, in callit
    func(*args)
...: line 253, in idle_draw
    self.draw()

Last rows:

.../venv/lib/python3.6/site-packages/mpl_toolkits/mplot3d/art3d.py", line 507, in do_3d_projection
    fcs = fcs[z_markers_idx]
IndexError: index 1 is out of bounds for axis 0 with size 1

Expected outcome

It should just plot two points in a 3D space.

Matplotlib version

  • Operating system: Ubuntu 18.04
  • Matplotlib version: 3.3.0
  • Matplotlib backend TkAgg:
  • Python version: 3.6.9
  • Jupyter version (if applicable): -
  • Other libraries:

I recently upgraded Matplotlib via pip:

pip install --upgrade matplotlib

And originally installed it with pip as well within a virtual environment created with python-venv. I tested the code above in an older virtual environment and no errors occur when using matplotlib version 3.2.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!status: confirmed bugtopic: mplot3d

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions