Skip to content

Added broadcasting support in some mplot3d methods #1074

Merged
merged 1 commit into from Aug 17, 2012

2 participants

@WeatherGod
Matplotlib Developers member

plot_surface and plot_wireframe gain the ability to allow for broadcastable inputs for X, Y, and Z.

@pelson
Matplotlib Developers member
pelson commented Aug 12, 2012

So the inputs x y and z must all be 3d right?

>>> x = np.arange(3)
>>> y = np.arange(4)
>>> z = np.arange(5)

>>> np.broadcast_arrays(x, y, z)
ValueError: shape mismatch: two or more arrays have incompatible dimensions on axis 0.

>>> x = np.arange(3)
>>> y = np.arange(4)
>>> z = np.arange(5)
>>> x.shape = (-1, 1, 1)
>>> y.shape = (1, -1, 1)
>>> z.shape = (1, 1, -1)

>>> X, Y, Z = np.broadcast_arrays(x, y, z)
>>> print Y.shape
(3, 4, 5)
>>> print y.shape
(1, 4, 1)
@WeatherGod
Matplotlib Developers member
@WeatherGod WeatherGod merged commit 2798e47 into matplotlib:master Aug 17, 2012
@WeatherGod WeatherGod deleted the WeatherGod:mplot3d/input_broadcast2 branch Jul 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.