8000 Axes3D.plot_surface with meshgrid args stopped working · Issue #7313 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Axes3D.plot_surface with meshgrid args stopped working #7313
Closed
@keszybz

Description

@keszybz

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 ...)
    Linux, python3-matplotlib-2.0.0-0.2.b4.fc26.x86_64, python3-3.5.2-5.fc26.x86_64
  • How did you install Matplotlib and Python (pip, anaconda, from source ...)
    Fedora packages (rawhide version).
  • If possible please supply a Short, 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.
# ackley.py
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

import numpy as np

fig = plt.figure()
ax = Axes3D(fig)
X = np.arange(-30, 30, 0.5)
Y = np.arange(-30, 30, 0.5)
X, Y = np.meshgrid(X, Y)
Z = np.zeros((X.shape[0], Y.shape[0]))

ax.plot_surface(X, Y, Z, rstride=1, cstride=1)

plt.show()

Under matplotlib-1.5.2 this shows a plot. Under matplotlib-2 it crashes with:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib64/python3.5/tkinter/__init__.py", line 1550, in __call__
    return self.func(*args)
  File "/usr/lib64/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 283, in resize
    self.show()
  File "/usr/lib64/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 354, in draw
    FigureCanvasAgg.draw(self)
  File "/usr/lib64/python3.5/site-packages/matplotlib/backends/backend_agg.py", line 463, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib64/python3.5/site-packages/matplotlib/artist.py", line 63, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib64/python3.5/site-packages/matplotlib/figure.py", line 1129, in draw
    renderer, self, dsu, self.suppressComposite)
  File "/usr/lib64/python3.5/site-packages/matplotlib/image.py", line 139, in _draw_list_compositing_images
    a.draw(renderer)
  File "/usr/lib64/python3.5/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 272, in draw
    for col in self.collections]
  File "/usr/lib64/python3.5/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 272, in <listcomp>
    for col in self.collections]
  File "/usr/lib64/python3.5/site-packages/mpl_toolkits/mplot3d/art3d.py", line 626, in do_3d_projection
    cedge = cedge.repeat(len(xyzlist), axis=0)
  File "/usr/lib64/python3.5/site-packages/numpy/ma/core.py", line 2549, in wrapped_method
    result = getattr(self._data, funcname)(*args, **params)
MemoryError

It tries to allocate cedge with size 56644 × 14161.

  • 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.

I'd guess that this is a matplotlib-2 regression. python3-matplotlib-1.5.2-0.1.rc2.fc24.x86_64 works fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0