Bottom Page

• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5 array issue paul18fr Not Blown Up Yet Posts: 66 Threads: 16 Joined: Apr 2019 Reputation: 2 Likes received: 2 #1 Aug-03-2019, 11:57 AM (This post was last modified: Aug-03-2019, 11:57 AM by paul18fr. Edited 1 time in total.) Dear All Here I've been using an example of tesselation from Matplotlib (triplot). hstack use leads to an error I cannot figure out; I'm probably missing things in arrays I gues What I do not understand? Thanks for any hep Paul import matplotlib.tri as tri import numpy as np n_angles = 36 n_radii = 8 min_radius = 0.25 radii = np.linspace(min_radius, 0.95, n_radii) angles = np.linspace(0, 2 * np.pi, n_angles, endpoint=False) angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) angles[:, 1::2] += np.pi / n_angles x = (radii * np.cos(angles)).flatten() y = (radii * np.sin(angles)).flatten() triang = tri.Triangulation(x, y) vertex = triang.triangles; temp1 = np.copy(vertex); temp2 = np.copy(vertex[:,0]); temp3 = np.hstack( (temp1, temp2) ); scidam  Posts: 541 Threads: 1 Joined: Mar 2018 Reputation: 71 Likes received: 76 #2 Aug-04-2019, 12:15 AM Check out shapes of temp1 and temp2. You probably need to convert temp2 to column-form, e.g. temp3 = np.hstack((temp1, temp2[:, None])) or temp3 = np.hstack((temp1, temp2[:, np.newaxis])). paul18fr Not Blown Up Yet Posts: 66 Threads: 16 Joined: Apr 2019 Reputation: 2 Likes received: 2 #3 Aug-04-2019, 07:07 AM Thanks scidam, you're right I postulated that tmp2 was a vector/column-form; something new I've to take care Paul « Next Oldest | Next Newest »

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)