Skip to content

Implement pyplot.box3d() for Axes3D #19310

Closed
@iuryt

Description

@iuryt

Problem

@cgentemann and I were discussing about implementing a new feature for matplotlib for a 3D plot formed by three separate 2D surface contour plots, like a box. She thinks box3d is a nice name for this feature to conform with matplotlib naming.

Here is a sample image of what I am asking for
image
image

Proposed Solution

The example of the implementation is the code in
https://github.com/iuryt/Panthalassan/blob/main/Tutorials/box3D.ipynb
and
https://github.com/cgentemann/cloud_science/blob/master/Butterfly/ecco_3d_eddy_image.ipynb

The idea is to have a way to do the same plot just doing

fig = plt.figure(figsize=(7,4))
ax = fig.add_subplot(111,projection='3d')
ax.box3d.pcolor(X,Y,Z,data,surfaces=[surfacex,surfacey,surfacez],offsets=[offsetx,offsety,offsetz],**kw)
#or
ax.box3d.contour(X,Y,Z,data,surfaces=[surfacex,surfacey,surfacez],offsets=[offsetx,offsety,offsetz],**kw)
#or
ax.box3d.contourf(X,Y,Z,data,surfaces=[surfacex,surfacey,surfacez],offsets=[offsetx,offsety,offsetz],**kw)

The default values for the offsets are the same as surfaces, but the user may want to plot a surface for a different offset.
The kw arguments are the same as for the used function.

Additional context and prior art

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions