NumPy Array Broadcasting: Combine 1D arrays into 2D

This NumPy Array Broadcasting example is inspired by this SciPy Lecture Chapter on Array Broadcasting.

Code:

Output:
array_broadcast_plot

Note the use of y[:, np.newaxis].

Note also that this example might be made much simplier with np.ogrid and np.mgrid. (See the SciPy-Lectures chapter on broadcasting)

Leave a reply