Modifying meshgrid function

I have this piece of code regarding the meshgrid function that I want to modify it's output:

x_list = list(range(5))
y_list = list(range(2))
X, Y = meshgrid(x_list, y_list)

which prints out:

array([[0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4]])


    Y = array([[0, 0, 0, 0, 0],
               [1, 1, 1, 1, 1]])

How can I modify my output to produce

    X = array([0,0,0,0,0],

and Y = array([0,1], [0,1], [0,1], [0,1], [0,1]]

instead? What I have in mind is something like this making X basically representing the x_axis values and Y the Y-axis values:

    03 13 23 33 43
    02 12 22 32 42
    01 11 21 31 41
    00 10 20 30 40

in the end I am doing something wrong I know it but I can't figure how to change the code in meshgrid in order to get me a normal x-y plane.


size= 4
X = np.array([np.zeros(size), np.ones(size)])
Y = X.copy().T

will get the output you want. But if you're using meshgrid, aren't you feeding functions that expect the format meshgrid produces?

Need Your Help

How to get a value on my jsf page using another value in my backing bean

hibernate jsf

i have a jsf page on which I have some values to display for e.g. box_name,appl_server_name which are not present in my backing bean.But I have values like box_id,appl_server_id which are also pres...

jQueryUI Tabs Loading Content Via AJAX Tab Into A New Selector?

javascript jquery jquery-ui-tabs

I'd like to be able to target where the AJAX content ends up. Does anyone have any ideas?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.