In the documentation it says that Axes3D.plot_wireframe(X, Y, Z, *args,

**kwargs) takes 2D arrays as the first two arguments. Do the arrays have to

have the same size dimensions?

## ···

--

View this message in context: http://old.nabble.com/Size-of-array-elements-when-using-Axes3D.plot_wireframe(X%2C-Y%2C-Z%2C-*args%2C-**kwargs)-tp34243823p34243823.html

Sent from the matplotlib - users mailing list archive at Nabble.com.

Working from memory, the first two have to at least be “broadcastable” into the shape of Z. But absolutely, if x, y, and z are 2d, they have to be the same shape. It makes no sense otherwise.

Cheers!

Ben Root

## ···

On Thursday, August 2, 2012, surfcast23 wrote:

surfcast23 wrote:

In the documentation it says that Axes3D.plot_wireframe(X, Y, Z, *args,

**kwargs) takes 2D arrays as the first two arguments. Do the arrays have

to have the same size dimensions?

Any one know?

Okay thank you! The Matlab code I am basing this on takes arrays of different

shapes with different sized elements ie

x = 1 512

y = 101 1

and I guess automatically makes the the same shape. Can you point me in the

direction of documentation that will explain how I can do this in Python?

Benjamin Root-2 wrote:

## ···

On Thursday, August 2, 2012, surfcast23 wrote:

surfcast23 wrote:

>

> In the documentation it says that Axes3D.plot_wireframe(X, Y, Z, *args,

> **kwargs) takes 2D arrays as the first two arguments. Do the arrays

have

> to have the same size dimensions?

>

>

Any one know?

Working from memory, the first two have to at least be "broadcastable"

into

the shape of Z. But absolutely, if x, y, and z are 2d, they have to be

the

same shape. It makes no sense otherwise.

Cheers!

Ben Root

------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and

threat landscape has changed and how IT managers can respond. Discussions

will include endpoint security, mobile security and the latest in malware

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--

View this message in context: http://old.nabble.com/Size-of-array-elements-when-using-Axes3D.plot_wireframe(X%2C-Y%2C-Z%2C-*args%2C-**kwargs)-tp34243823p34248914.html

Sent from the matplotlib - users mailing list archive at Nabble.com.

Ok, I just double-checked the source for plot_wireframe(). It does not perform any broadcasting (which I consider to be a bug).

Until it is fixed, you will have to do the broadcasting yourself:

X= np.ones((1, 45))

Y= np.zeros((32, 1))

x, y = np.broadcast_arrays(X, Y)

Which produces x and y with the same shapes, and their values duplicated in the direction the array was “expanded”.

Pass those into plot_wireframe().

Ben Root

## ···

On Thursday, August 2, 2012, surfcast23 wrote:

Okay thank you! The Matlab code I am basing this on takes arrays of different

shapes with different sized elements ie

x = 1 512

y = 101 1

and I guess automatically makes the the same shape. Can you point me in the

direction of documentation that will explain how I can do this in Python?

Wouldn't

X= np.ones((1, 45))

Y= np.zeros((32, 1))

change the existing values of the elements to ones and zeros?

Benjamin Root-2 wrote:

## ···

On Thursday, August 2, 2012, surfcast23 wrote:

Okay thank you! The Matlab code I am basing this on takes arrays of

different

shapes with different sized elements ie

x = 1 512

y = 101 1

and I guess automatically makes the the same shape. Can you point me in

the

direction of documentation that will explain how I can do this in Python?

Ok, I just double-checked the source for plot_wireframe(). It does not

perform any broadcasting (which I consider to be a bug).

Until it is fixed, you will have to do the broadcasting yourself:

X= np.ones((1, 45))

Y= np.zeros((32, 1))

x, y = np.broadcast_arrays(X, Y)

Which produces x and y with the same shapes, and their values duplicated

in

the direction the array was "expanded".

Pass those into plot_wireframe().

Ben Root

------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and

threat landscape has changed and how IT managers can respond. Discussions

will include endpoint security, mobile security and the latest in malware

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--

View this message in context: http://old.nabble.com/Size-of-array-elements-when-using-Axes3D.plot_wireframe(X%2C-Y%2C-Z%2C-*args%2C-**kwargs)-tp34243823p34249151.html

Sent from the matplotlib - users mailing list archive at Nabble.com.

sorry misssed this line "Which produces x and y with the same shapes, and

their values duplicated in

the direction the array was "expanded"."

surfcast23 wrote:

## ···

Wouldn't

X= np.ones((1, 45))

Y= np.zeros((32, 1))

change the existing values of the elements to ones and zeros?

Benjamin Root-2 wrote:

On Thursday, August 2, 2012, surfcast23 wrote:

Okay thank you! The Matlab code I am basing this on takes arrays of

different

shapes with different sized elements ie

x = 1 512

y = 101 1

and I guess automatically makes the the same shape. Can you point me in

the

direction of documentation that will explain how I can do this in

Python?

Ok, I just double-checked the source for plot_wireframe(). It does not

perform any broadcasting (which I consider to be a bug).

Until it is fixed, you will have to do the broadcasting yourself:

X= np.ones((1, 45))

Y= np.zeros((32, 1))

x, y = np.broadcast_arrays(X, Y)

Which produces x and y with the same shapes, and their values duplicated

in

the direction the array was "expanded".

Pass those into plot_wireframe().

Ben Root

------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and

threat landscape has changed and how IT managers can respond. Discussions

will include endpoint security, mobile security and the latest in malware

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--

View this message in context: http://old.nabble.com/Size-of-array-elements-when-using-Axes3D.plot_wireframe(X%2C-Y%2C-Z%2C-*args%2C-**kwargs)-tp34243823p34249160.html

Sent from the matplotlib - users mailing list archive at Nabble.com.

I was just demonstrating what np.broadcast_arrays() does. Take your x and y arrays and put them through this function and put the outputs into plot_wireframe(). Ignore the ones() and zeros().

Ben Root

## ···

On Thursday, August 2, 2012, surfcast23 wrote:

Wouldn’t

X= np.ones((1, 45))

Y= np.zeros((32, 1))

change the existing values of the elements to ones and zeros?

I tested it out and it does change all the values to ones and zeros. Is there

a way to broadcast and keep the original values that were in the arrays?

Thanks for the help

Benjamin Root-2 wrote:

## ···

On Thursday, August 2, 2012, surfcast23 wrote:

Okay thank you! The Matlab code I am basing this on takes arrays of

different

shapes with different sized elements ie

x = 1 512

y = 101 1

and I guess automatically makes the the same shape. Can you point me in

the

direction of documentation that will explain how I can do this in Python?

Ok, I just double-checked the source for plot_wireframe(). It does not

perform any broadcasting (which I consider to be a bug).

Until it is fixed, you will have to do the broadcasting yourself:

X= np.ones((1, 45))

Y= np.zeros((32, 1))

x, y = np.broadcast_arrays(X, Y)

Which produces x and y with the same shapes, and their values duplicated

in

the direction the array was "expanded".

Pass those into plot_wireframe().

Ben Root

------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and

threat landscape has changed and how IT managers can respond. Discussions

will include endpoint security, mobile security and the latest in malware

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--

View this message in context: http://old.nabble.com/Size-of-array-elements-when-using-Axes3D.plot_wireframe(X%2C-Y%2C-Z%2C-*args%2C-**kwargs)-tp34243823p34249203.html

Sent from the matplotlib - users mailing list archive at Nabble.com.

Don’t use ones() and zeros(). It was just a way to swtup a demonstration since I dont have your data. Use your data instead of my ones() and zeros().

Also, it would be more useful to post your latest version of your code that is causing problems so that we can double-check it, rather than guessing what the problem is.

Cheers!

Ben Root

## ···

On Friday, August 3, 2012, surfcast23 wrote:

I tested it out and it does change all the values to ones and zeros. Is there

a way to broadcast and keep the original values that were in the arrays?

Thanks for the help

Gotcha ya working perfectly now thank you for the help!

Benjamin Root-2 wrote:

## ···

On Thursday, August 2, 2012, surfcast23 wrote:

Wouldn't

X= np.ones((1, 45))

Y= np.zeros((32, 1))

change the existing values of the elements to ones and zeros?

I was just demonstrating what np.broadcast_arrays() does. Take your x and

y arrays and put them through this function and put the outputs into

plot_wireframe(). Ignore the ones() and zeros().

Ben Root

------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and

threat landscape has changed and how IT managers can respond. Discussions

will include endpoint security, mobile security and the latest in malware

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--

View this message in context: http://old.nabble.com/Size-of-array-elements-when-using-Axes3D.plot_wireframe(X%2C-Y%2C-Z%2C-*args%2C-**kwargs)-tp34243823p34249265.html

Sent from the matplotlib - users mailing list archive at Nabble.com.