Skip to content

[Bug]: Surface draws incorrectly after set_verts on Poly3DCollection  #21163

@ccaprani

Description

@ccaprani

Bug summary

Surface is not rendered properly after changing the data using set_verts: the simple MWE below shows the effect.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

x = np.array([10, -10])
y = np.array([25, -25])
z = 5

X, Y = np.meshgrid(x, y)
Z = z * np.ones_like(X)

fig = plt.figure(figsize=(8, 4.5))
ax = fig.add_subplot(projection="3d")

ax.axes.set_xlim3d(left=-15, right=15)
ax.axes.set_ylim3d(bottom=-30, top=30)
ax.axes.set_zlim3d(bottom=0, top=10)

surf = ax.plot_surface(X, Y, Z, color="r", alpha=0.3)
plt.pause(1.0)

time = np.linspace(0, 5, 101)
for t in time:
    zt = z + 2 * np.sin(2 * np.pi * t)
    Z = zt * np.ones_like(X)
    verts = np.array([X, Y, Z]).T.reshape(4, 3)
    surf.set_verts(verts)
    plt.pause(0.1)

Actual outcome

image

Expected outcome

The full surface, as is shown prior to updating using set_verts should be shown:

image

Operating system

Ubuntu 21.04

Matplotlib Version

3.4.2

Matplotlib Backend

Qt5Agg

Python version

3.8.11

Jupyter version

No response

Other libraries

No response

Installation

conda

Conda channel

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No 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