How to draw circle by data with matplotlib + python? -


I can draw a circle with scatter , which is shown in the image. But I want to draw them to buy a line, since there are several divisions in total, I need to add the nodes together for a specific cycle. Thank you. Enter image details here

Make some random sequence points first:

NP angle = NP. Range (0, NPPI.2, 0.05) r = 50 + N.P. Randem. Normal (0, 2, angle.Sp) x = R * np.cos (angle) y = r * np.sin (angle) idx = np.random.permutation (angle.shape [0]) x = x [idx ] Y = y [idx]

Then use arctan2 () to analyze the angle, and sort the data by:

  angle = np.arctan2 (x, y) command = np.argsort (angle) x = x [command] y = y [command] fig, ax = pl.subplots () ax.set_aspect (1.0 ) X2 = np.r_ [x, x [0]] y2 = Ax.plot (x, y, "o") ax.plot (x2, y2, "r", lw = 2)  

NPR_ [y, y [0] is produced here:

Enter image details here


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -