in VTK, move point but keep the mesh (python) - python

Main question : I would like to know if it is possible to move a point in one direction but keep the mesh in vtk-Python (see image below)
I am new to vtk and would like to know if something is possible and if it is, which function to use. (I will give the context under if someone have a more clever idea).
I am using the vtk library with python and came across a pb with the delaunay_2d meshing.
I have a mesh that is mostly flat but with little variation
if you lunch this code, you will see that the meshing is really weird :
import pyvista as pv
import vtk as vtk
a=[[146.2346, -0.06153386, 611.2706],[146.1978, -0.05672521, 611.269],[146.1624, -0.05195256, 611.2675],[146.1345, -0.04595259, 611.2665],[146.0745, -0.02889959, 611.2647],[145.967, -0.01271295, 611.2602],[145.8994, -0.009446936, 611.2567],[145.7876, -0.01544256, 611.2445],[145.6697, -0.02221904, 611.2313],[145.6411, -0.02354358, 611.2281],[145.6213, -0.02429816, 611.226],[145.6148, -0.02446534, 611.2249],[145.6086, -0.02457465, 611.2237],[145.6037, -0.02456888, 611.2228],[145.5997, -0.02445992, 611.2221],[145.5722, -0.02384555, 611.2174],[145.4821, -0.02229311, 611.202],[145.3932, -0.02014619, 611.1866],[145.3392, -0.01758623, 611.1768],[145.2826, -0.01470557, 611.1657],[145.242, -0.01272894, 611.157],[145.2183, -0.01186882, 611.1517],[145.201, -0.01120841, 611.1478],[145.1839, -0.01051717, 611.1439],[145.17, -0.00969123, 611.1407],[145.1583, -0.008427223, 611.1383],[145.1294, -0.007862877, 611.1321],[145.1014, -0.008404535, 611.1261],[145.0899, -0.008730335, 611.1237],[145.0849, -0.008798788, 611.1226],[145.0315, -0.009818145, 611.1109],[144.9335, -0.01140382, 611.0887],[144.8838, -0.01200129, 611.077],[144.8506, -0.0121375, 611.0691],[144.7955, -0.01213034, 611.0557],[144.7571, -0.01195927, 611.0462],[144.7039, -0.0117043, 611.0333],[144.639, -0.01079165, 611.0176],[144.5931, -0.01010639, 611.0062],[144.5228, -0.01040282, 610.9877],[144.4637, -0.01073657, 610.972],[144.4376, -0.01124127, 610.9651],[144.413, -0.01201134, 610.9583],[144.3769, -0.01325327, 610.9479],[144.3213, -0.01482141, 610.9319],[144.2883, -0.01556498, 610.9223],[144.2539, -0.01585945, 610.9122],[144.1733, -0.01677441, 610.8897],[144.1193, -0.01754921, 610.8751],[144.1092, -0.01772558, 610.8723],[144.1012, -0.01783123, 610.8702],[144.0963, -0.01781308, 610.8689],[144.0742, -0.0179998, 610.8631],[144.0339, -0.01839697, 610.853],[143.9804, -0.01873316, 610.8398],[143.9467, -0.01887846, 610.8315],[143.9274, -0.01891992, 610.8267],[143.8417, -0.01886452, 610.8066],[143.7705, -0.01871645, 610.79],[143.7586, -0.01850215, 610.7873],[140.9641, 0.002861298, 575.0103],[140.975, 0.0004340185, 574.9571],[140.9918, -0.004345077, 574.8732],[140.9989, -0.00678831, 574.8369],[141.0005, -0.007331287, 574.8288],[141.0033, -0.00870053, 574.8147],[141.0085, -0.01185749, 574.79],[141.0185, -0.01458415, 574.7529],[141.0268, -0.01585665, 574.7258],[141.0422, -0.02161443, 574.6707],[141.0595, -0.02673956, 574.6101],[141.0743, -0.02733954, 574.5637],[141.0923, -0.02482757, 574.5121],[141.1047, -0.01995062, 574.4816],[141.112, -0.01798161, 574.4629],[141.1168, -0.01754502, 574.4503],[141.1319, -0.01713058, 574.4153],[141.148, -0.01711672, 574.3782],[141.1785, -0.01743222, 574.3112],[141.2074, -0.01777238, 574.2482],[141.2119, -0.01781772, 574.2393],[141.2374, -0.02053488, 574.193],[141.2616, -0.02339841, 574.1488],[141.2682, -0.02405973, 574.1371],[141.2773, -0.02454154, 574.121],[141.2984, -0.0244909, 574.0833],[141.3239, -0.02285809, 574.0379],[141.362, -0.02366696, 573.9743],[141.4008, -0.02681, 573.9104],[141.4111, -0.02758676, 573.8934],[141.4149, -0.02748217, 573.8879],[141.4247, -0.02697612, 573.8746],[141.4432, -0.02813518, 573.8474],[141.4665, -0.03125831, 573.8114],[141.4852, -0.03241773, 573.7831],[141.5292, -0.03128803, 573.7191],[141.5682, -0.03055324, 573.6623],[141.5732, -0.03044086, 573.655],[141.592, -0.02969062, 573.6299],[141.6085, -0.02897164, 573.6082],[141.6247, -0.02817515, 573.5873],[141.6633, -0.02625679, 573.5373],[141.711, -0.0244699, 573.4756],[141.7424, -0.02377839, 573.435],[141.7517, -0.02353401, 573.4231],[141.7648, -0.02296879, 573.4082],[141.7862, -0.02246382, 573.3844],[141.8357, -0.02191633, 573.3298],[141.9018, -0.02097274, 573.2567],[141.9447, -0.02015587, 573.2089],[141.9606, -0.0198681, 573.1911],[141.961, -0.01985728, 573.1907],[141.9736, -0.0194613, 573.1782],[141.9873, -0.01920701, 573.1648],[141.9997, -0.02040373, 573.153],[142.0396, -0.02199398, 573.1149],[142.1073, -0.02463654, 573.0479],[142.176, -0.02768754, 572.9786],[142.2113, -0.02821711, 572.9433],[142.2351, -0.02649652, 572.9198],[142.3082, -0.02100548, 572.8537],[142.3686, -0.01652271, 572.8005],[142.3796, -0.01589324, 572.7906],[142.3981, -0.01486295, 572.7743],[142.4123, -0.01408919, 572.7619],[142.4144, -0.01399181, 572.76],[142.4179, -0.01407487, 572.757],[142.448, -0.01566364, 572.7316],[142.5282, -0.01877348, 572.6642],[142.5982, -0.02105116, 572.6056],[142.6172, -0.02173755, 572.5896],[142.6276, -0.021897, 572.5812],[142.6731, -0.02252371, 572.5445],[142.7521, -0.02395345, 572.4821],[142.8003, -0.02493422, 572.4448],[142.8347, -0.02538628, 572.4179],[142.8763, -0.02544799, 572.3859],[142.9153, -0.02413499, 572.3573],[142.9477, -0.02288336, 572.3338],[142.9768, -0.02149255, 572.3131],[143.0515, -0.01691165, 572.2601],[143.1274, -0.01455436, 572.2069],[143.1697, -0.01542038, 572.178],[143.2005, -0.01505758, 572.1568],[143.2495, -0.01680911, 572.1242],[143.2874, -0.01877392, 572.0992],[143.3077, -0.01987864, 572.0859],[143.3509, -0.02099498, 572.0578],[143.4083, -0.01987314, 572.021],[143.4909, -0.01770812, 571.9689],[143.5684, -0.01706533, 571.9212],[143.5987, -0.01741168, 571.9031],[143.6137, -0.01759005, 571.8942],[143.6689, -0.01668662, 571.8615],[143.7408, -0.01502007, 571.8187],[143.7993, -0.01439461, 571.7853],[143.8609, -0.0165276, 571.7517],[143.8997, -0.01897029, 571.7308],[143.9147, -0.01910335, 571.7229],[143.9507, -0.0185069, 571.704],[144.013, -0.01750005, 571.6713],[144.0648, -0.01632737, 571.6442],[144.0993, -0.01506928, 571.6263],[144.1447, -0.01443901, 571.6029],[144.1923, -0.01450271, 571.579],[144.2355, -0.01467142, 571.558],[144.283, -0.01480775, 571.5352],[144.3439, -0.01599414, 571.5067],[144.4027, -0.01789944, 571.4795],[144.4572, -0.01791742, 571.4552],[144.5246, -0.01659406, 571.4258],[144.5738, -0.01525325, 571.4047],[144.6097, -0.01443211, 571.3898],[144.6464, -0.01424885, 571.3747],[144.6945, -0.01390467, 571.3555],[144.7463, -0.01350234, 571.3347],[144.7808, -0.01354561, 571.3207],[144.8094, -0.01393717, 571.3094],[144.8693, -0.01412922, 571.2871],[144.9426, -0.01378092, 571.2596],[144.9972, -0.01244129, 571.2401],[145.0396, -0.01095316, 571.2258],[145.0826, -0.00853111, 571.211],[145.1198, -0.006981449, 571.1983],[145.1381, -0.009466066, 571.1928],[145.1525, -0.01155278, 571.1885],[145.1717, -0.01150764, 571.1826],[145.1954, -0.01155187, 571.1752],[145.222, -0.01203899, 571.1672],[145.2529, -0.01274025, 571.158],[145.271, -0.01319267, 571.1527],[145.2814, -0.01332585, 571.1496],[145.2997, -0.01334692, 571.1445],[145.3551, -0.01436899, 571.1286],[145.4116, -0.0157692, 571.1123],[145.4388, -0.01593566, 571.1048],[145.4774, -0.0152119, 571.0944],[145.5604, -0.01549523, 571.075],[145.6195, -0.01626525, 571.0623],[145.6802, -0.01707819, 571.0502],[145.7626, -0.01802136, 571.0355],[145.8255, -0.01808286, 571.027],[145.8883, -0.01794028, 571.0183],[145.9254, -0.0178556, 571.0136],[145.9446, -0.017869, 571.0114],[145.984, -0.01818962, 571.0074],[146.0778, -0.01925302, 570.9996],[146.1833, -0.02391875, 570.992],[146.2321, -0.0281701, 570.9886],[146.2426, -0.02938274, 570.9879],[146.2166, -0.05736815, 611.4644],[146.174, -0.05089068, 611.4629],[146.1599, -0.04873756, 611.4623],[146.1137, -0.03929245, 611.4614],[146.0483, -0.02763847, 611.4596],[146.012, -0.02361259, 611.4579],[145.9631, -0.022168, 611.4549],[145.9114, -0.02165178, 611.4517],[145.8622, -0.01918254, 611.4482],[145.8258, -0.01688459, 611.4455],[145.812, -0.01702635, 611.4443],[145.699, -0.02098855, 611.4307],[145.5503, -0.0264029, 611.4119],[145.4873, -0.02732343, 611.4034],[145.4437, -0.02593876, 611.3963],[145.3971, -0.02403616, 611.3883],[145.3718, -0.02247259, 611.3837],[145.3409, -0.02103397, 611.3775],[145.3073, -0.01946996, 611.3708],[145.2901, -0.01852485, 611.3673],[145.1439, -0.01363603, 611.336],[145.0007, -0.008871335, 611.3053],[144.9918, -0.008317093, 611.3033],[144.9818, -0.00827229, 611.3011],[144.9711, -0.008648629, 611.2987],[144.9585, -0.00894847, 611.296],[144.9434, -0.009202947, 611.2927],[144.9355, -0.009293081, 611.291],[144.9336, -0.009293889, 611.2906],[144.9196, -0.009484665, 611.287],[144.8996, -0.009810211, 611.2818],[144.8846, -0.01014345, 611.2779],[144.8513, -0.01053094, 611.2692],[144.807, -0.01110086, 611.2577],[144.726, -0.01263126, 611.2365],[144.6032, -0.01377125, 611.2053],[144.5243, -0.01371456, 611.1859],[144.4985, -0.01368977, 611.1796],[144.4893, -0.01365795, 611.1773],[144.4804, -0.01371251, 611.1751],[144.4578, -0.0137947, 611.1696],[144.4187, -0.01381266, 611.16],[144.3741, -0.01397462, 611.1485],[144.3052, -0.01446937, 611.1297],[144.2563, -0.01481979, 611.1164],[144.255, -0.01484228, 611.116],[144.2525, -0.01495003, 611.1153],[144.2264, -0.01614293, 611.1078],[144.1978, -0.01735986, 611.0995],[144.1808, -0.01762734, 611.0947],[144.1633, -0.01779159, 611.0898],[144.1078, -0.01793095, 611.0743],[144.0449, -0.01793684, 611.057],[143.901, -0.01699888, 611.0205],[143.7598, -0.01609495, 610.9845],[140.8673, 0.004013773, 575.0136],[140.8857, -0.002197082, 574.9198],[140.9067, -0.01009257, 574.8142],[140.9167, -0.01630242, 574.765],[140.9439, -0.02201862, 574.668],[140.9666, -0.02335378, 574.5981],[140.9771, -0.02513118, 574.5642],[140.9885, -0.02729319, 574.527],[140.9966, -0.02716472, 574.502],[141.0051, -0.02627761, 574.4758],[141.0116, -0.02506499, 574.457],[141.0199, -0.02063325, 574.4372],[141.0487, -0.02102182, 574.3722],[141.0777, -0.02478343, 574.3076],[141.0955, -0.02463576, 574.2666],[141.1121, -0.02457507, 574.229],[141.1173, -0.02461446, 574.2178],[141.1236, -0.02464042, 574.2063],[141.135, -0.02530249, 574.1858],[141.1744, -0.02652624, 574.1139],[141.2091, -0.02709656, 574.0502],[141.2377, -0.02136374, 574.0002],[141.2738, -0.01635836, 573.9381],[141.2848, -0.0172927, 573.9203],[141.2951, -0.01758817, 573.9031],[141.3037, -0.01760539, 573.889],[141.3268, -0.01604579, 573.858],[141.3539, -0.01518705, 573.8207],[141.4088, -0.02247747, 573.7359],[141.4684, -0.02852728, 573.6449],[141.4843, -0.02764272, 573.6221],[141.5006, -0.02728717, 573.5983],[141.5111, -0.02722914, 573.5829],[141.5118, -0.02722982, 573.5818],[141.5132, -0.02715779, 573.5799],[141.5294, -0.02634171, 573.5587],[141.5565, -0.02501735, 573.5232],[141.6001, -0.02373889, 573.4655],[141.6579, -0.0224396, 573.3887],[141.6878, -0.0217516, 573.3498],[141.7011, -0.02140111, 573.3354],[141.7217, -0.02115995, 573.3127],[141.7776, -0.020856, 573.25],[141.8334, -0.02046155, 573.1874],[141.8645, -0.01999886, 573.1532],[141.8853, -0.01960157, 573.1304],[141.9001, -0.01918023, 573.114],[141.9348, -0.01900096, 573.08],[141.9562, -0.01924281, 573.0596],[141.993, -0.02112808, 573.022],[142.0713, -0.02525797, 572.941],[142.1216, -0.02746505, 572.8884],[142.1362, -0.02698184, 572.8736],[142.1481, -0.02621646, 572.8619],[142.168, -0.02474578, 572.8435],[142.2107, -0.02196891, 572.8044],[142.2444, -0.01999198, 572.7731],[142.2713, -0.01863434, 572.7483],[142.2985, -0.01733583, 572.7234],[142.3336, -0.01569685, 572.6921],[142.405, -0.01668335, 572.6296],[142.4628, -0.01980776, 572.5797],[142.5035, -0.02117437, 572.5449],[142.5384, -0.02189425, 572.5152],[142.5685, -0.02228352, 572.4902],[142.6137, -0.02278752, 572.4529],[142.6642, -0.02303429, 572.4118],[142.7085, -0.02325433, 572.3763],[142.766, -0.02257066, 572.3312],[142.8821, -0.01881034, 572.2437],[142.9597, -0.01593948, 572.1861],[142.9696, -0.01544765, 572.1788],[143.0172, -0.01338197, 572.1437],[143.076, -0.0114591, 572.101],[143.1149, -0.01234147, 572.0739],[143.1691, -0.01581758, 572.037],[143.2065, -0.01815548, 572.0118],[143.2522, -0.01978064, 571.9809],[143.3011, -0.02127273, 571.948],[143.3377, -0.02081609, 571.9245],[143.4183, -0.01950245, 571.8726],[143.4902, -0.01807297, 571.8264],[143.5343, -0.0175391, 571.7987],[143.5608, -0.01759356, 571.7825],[143.5911, -0.01717058, 571.764],[143.6458, -0.01607553, 571.7306],[143.693, -0.01547654, 571.7024],[143.7485, -0.01548299, 571.6709],[143.8175, -0.01574977, 571.6315],[143.8708, -0.01652237, 571.6017],[143.9491, -0.0160313, 571.5596],[144.0184, -0.01483544, 571.5227],[144.0363, -0.01447774, 571.5131],[144.0637, -0.01432391, 571.4987],[144.1224, -0.01434779, 571.4677],[144.1715, -0.01442718, 571.4422],[144.1953, -0.0145433, 571.4302],[144.2665, -0.01480657, 571.3962],[144.3489, -0.0163923, 571.3569],[144.3814, -0.01844081, 571.3411],[144.4083, -0.01861602, 571.3284],[144.4675, -0.01694035, 571.301],[144.5175, -0.01574981, 571.2781],[144.5462, -0.01568998, 571.2656],[144.5934, -0.01550807, 571.2451],[144.6454, -0.01547175, 571.2229],[144.7203, -0.01478874, 571.1919],[144.7835, -0.01376356, 571.1663],[144.8243, -0.01432241, 571.1497],[144.8731, -0.01529546, 571.1301],[144.8973, -0.01541066, 571.1205],[144.9038, -0.01508989, 571.1182],[144.916, -0.01455041, 571.1138],[144.9556, -0.01379068, 571.1005],[145.0602, -0.01391453, 571.0649],[145.1478, -0.01465114, 571.0349],[145.1655, -0.01478407, 571.0288],[145.1696, -0.0147913, 571.0275],[145.211, -0.01551238, 571.0156],[145.2521, -0.01625661, 571.0038],[145.2546, -0.01630192, 571.0031],[145.2582, -0.01633627, 571.002],[145.2917, -0.01701197, 570.9917],[145.3685, -0.01865086, 570.9682],[145.4243, -0.01943179, 570.9514],[145.45, -0.01889651, 570.9444],[145.4817, -0.01872314, 570.9368],[145.5508, -0.01847148, 570.9219],[145.6074, -0.01799234, 570.9097],[145.6385, -0.01740676, 570.9026],[145.6757, -0.01686226, 570.8941],[145.7179, -0.01731708, 570.8865],[145.7814, -0.01844415, 570.8759],[145.8272, -0.01896315, 570.8686],[145.8773, -0.01869122, 570.8623],[145.9458, -0.01847936, 570.8543],[145.985, -0.01839645, 570.8498],[146.0081, -0.01854843, 570.8472],[146.0541, -0.02106533, 570.8432],[146.1355, -0.02782925, 570.8374],[146.2059, -0.03366203, 570.8322],[146.2263, -0.03505306, 570.8305],[146.2396, -0.03491875, 570.8296]]
cloud = pv.PolyData(tab_point_ds_np)
surf_inter = cloud.delaunay_2d(alpha=0.35)
image = pv.Plotter()
image.add_mesh(surf_inter, show_edges=True)
image.add_points(cloud)
image.add_axes(interactive=True)
image.view_zx()
image.show()
but if i just add that after the generation of 'a' to make the point cloud flat, the delaunay_2D work perfectly:
for i in range(len(a)):
a[i][1] = 0 # Every y at 0
here is the image with and without making it flat :
So my idea was:
generate a flat mesh
move each point on the mesh at the correct altitude
Thanks in advance for your help

Just overwrite the points after having created the triangulation with the flat point array:
cloud.points = np.array([[v[0],0,v[2]] for v in a])
surf_inter = cloud.delaunay_2d(alpha=0.35)
surf_inter.points = np.array(a)

Related

Creating a DXF polyline from a list of 3D coordinates

I'm trying to create a 3D polyline from a list of coordinates using EZDXF in Python. I modified this script and it works great. I can import it in Fusion and can see the points in 3D space. The thing is, I would like to make a polyline instead.
I've tried using the add_polyline3d function but it's not working. The script executes just fine but when I try to import the DXF file, it's empty.
Here's the code I used:
import ezdxf
from ezdxf.gfxattribs import GfxAttribs
from ezdxf import units
doc = ezdxf.new("R2000")
doc.units = units.CM
msp = doc.modelspace()
attribsp = GfxAttribs(layer="LINE")
msp.add_polyline3d([(0.0, 0.0, 0.0), (-0.00961, -0.0224, -0.83254), (-0.037, -0.0909, -1.6623), (-0.0789, -0.20771, -2.4859), (-0.13198, -0.37455, -3.3001), (-0.19328, -0.59253, -4.1016), (-0.25978, -0.86226, -4.8867), (-0.32886, -1.1838, -5.6518), (-0.39809, -1.5566, -6.3932), (-0.46537, -1.9799, -7.1073), (-0.5289, -2.4521, -7.7904), (-0.58727, -2.9713, -8.4389), (-0.63937, -3.5352, -9.0496), (-0.68449, -4.1406, -9.6196), (-0.7222, -4.7847, -10.146), (-0.75252, -5.4636, -10.628), (-0.77571, -6.1739, -11.062), (-0.79238, -6.912, -11.447), (-0.80336, -7.6744, -11.782), (-0.80965, -8.4574, -12.066), (-0.81234, -9.2574, -12.298), (-0.81256, -10.071, -12.477), (-0.81148, -10.894, -12.603), (-0.81031, -11.724, -12.677), (-0.81028, -12.556, -12.698), (-0.81257, -13.389, -12.667), (-0.81821, -14.218, -12.585), (-0.82809, -15.04, -12.452), (-0.84291, -15.853, -12.271), (-0.86326, -16.654, -12.042), (-0.88953, -17.44, -11.768), (-0.92199, -18.209, -11.45), (-0.96075, -18.959, -11.09), (-1.0059, -19.688, -10.69), (-1.0574, -20.395, -10.252), (-1.1154, -21.078, -9.7787), (-1.1797, -21.736, -9.2714), (-1.2506, -22.366, -8.732), (-1.3281, -22.969, -8.1622), (-1.4122, -23.543, -7.5638), (-1.5032, -24.085, -6.9385), (-1.601, -24.596, -6.2879), (-1.7055, -25.074, -5.6138), (-1.8167, -25.519, -4.9179), (-1.9343, -25.928, -4.202), (-2.0576, -26.302, -3.4678), (-2.186, -26.64, -2.7174), (-2.3187, -26.942, -1.9524), (-2.4548, -27.207, -1.1744), (-2.5932, -27.436, -0.38543), (-2.7326, -27.629, 0.41293), (-2.8715, -27.787, 1.219), (-3.0086, -27.911, 2.0312), (-3.1422, -28.004, 2.8483), (-3.2707, -28.067, 3.6691), (-3.3926, -28.102, 4.4926), (-3.5063, -28.112, 5.3179), (-3.6101, -28.099, 6.1445), (-3.7027, -28.065, 6.9719), (-3.7826, -28.013, 7.7997), (-3.8486, -27.945, 8.6275), (-3.8996, -27.863, 9.4551), (-3.9343, -27.77, 10.282), (-3.9519, -27.668, 11.109), (-3.9514, -27.558, 11.935), (-3.9318, -27.444, 12.76), (-3.8925, -27.326, 13.584), (-3.8327, -27.208, 14.407), (-3.7518, -27.09, 15.228), (-3.6494, -26.974, 16.046), (-3.5254, -26.862, 16.862), (-3.3798, -26.755, 17.676), (-3.2129, -26.655, 18.486), (-3.0254, -26.564, 19.293), (-2.8177, -26.481, 20.095), (-2.5907, -26.409, 20.894), (-2.3452, -26.348, 21.688), (-2.0822, -26.299, 22.477), (-1.8028, -26.262, 23.261), (-1.5079, -26.237, 24.04), (-1.1983, -26.226, 24.813), (-0.87464, -26.228, 25.581), (-0.53727, -26.244, 26.343), (-0.18642, -26.274, 27.098), (0.17803, -26.32, 27.846), (0.55634, -26.381, 28.585), (0.94884, -26.459, 29.316), (1.3559, -26.554, 30.037), (1.7778, -26.668, 30.746), (2.2148, -26.8, 31.443), (2.6667, -26.951, 32.127), (3.133, -27.122, 32.795), (3.6133, -27.313, 33.449), (4.1064, -27.525, 34.086), (4.6113, -27.758, 34.707), (5.1265, -28.012, 35.31), (5.6502, -28.288, 35.896), (6.1804, -28.588, 36.465), (6.7151, -28.91, 37.016), (7.2522, -29.257, 37.551), (7.7895, -29.629, 38.068), (8.3246, -30.027, 38.567), (8.8552, -30.452, 39.048), (9.3792, -30.906, 39.51), (9.8942, -31.389, 39.953), (10.398, -31.901, 40.374), (10.889, -32.443, 40.774), (11.364, -33.014, 41.15), (11.822, -33.615, 41.501), (12.26, -34.244, 41.826), (12.677, -34.902, 42.122), (13.071, -35.585, 42.389), (13.44, -36.294, 42.624), (13.782, -37.026, 42.827), (14.097, -37.778, 42.994), (14.383, -38.549, 43.125), (14.64, -39.336, 43.22), (14.866, -40.136, 43.276), (15.062, -40.945, 43.293), (15.228, -41.761, 43.271), (15.362, -42.58, 43.21), (15.467, -43.4, 43.11), (15.542, -44.218, 42.971), (15.587, -45.03, 42.792), (15.604, -45.834, 42.575), (15.592, -46.627, 42.32), (15.554, -47.406, 42.028), (15.49, -48.169, 41.7), (15.401, -48.914, 41.338), (15.289, -49.638, 40.942), (15.153, -50.34, 40.515), (14.996, -51.018, 40.057), (14.817, -51.67, 39.571), (14.619, -52.295, 39.057), (14.402, -52.892, 38.519), (14.168, -53.46, 37.956), (13.916, -53.997, 37.371), (13.649, -54.504, 36.767), (13.366, -54.979, 36.144), (13.069, -55.422, 35.504), (12.758, -55.832, 34.848), (12.434, -56.209, 34.18), (12.098, -56.553, 33.5), (11.749, -56.863, 32.81), (11.389, -57.139, 32.111), (11.018, -57.382, 31.406), (10.636, -57.591, 30.696), (10.244, -57.768, 29.982), (9.8417, -57.912, 29.267), (9.4299, -58.024, 28.551), (9.0089, -58.104, 27.837), (8.5791, -58.154, 27.125), (8.1409, -58.175, 26.417), (7.6945, -58.166, 25.713), (7.2404, -58.13, 25.016), (6.7786, -58.068, 24.325), (6.3092, -57.98, 23.643), (5.8322, -57.868, 22.969), (5.3474, -57.732, 22.305), (4.8546, -57.576, 21.651), (4.3535, -57.399, 21.01), (3.8436, -57.203, 20.38), (3.3245, -56.99, 19.764), (2.7958, -56.761, 19.163), (2.257, -56.518, 18.575), (1.7079, -56.261, 18.004), (1.1479, -55.994, 17.448), (0.5765, -55.716, 16.909), (-0.00687, -55.43, 16.387), (-0.60281, -55.138, 15.884), (-1.2119, -54.841, 15.399), (-1.8348, -54.541, 14.934), (-2.4721, -54.24, 14.49), (-3.1239, -53.939, 14.066), (-3.7906, -53.642, 13.665), (-4.4722, -53.349, 13.286), (-5.1687, -53.061, 12.931), (-5.8796, -52.782, 12.598), (-6.6048, -52.512, 12.289), (-7.3438, -52.254, 12.005), (-8.0958, -52.008, 11.744), (-8.8603, -51.775, 11.508), (-9.6364, -51.559, 11.297), (-10.423, -51.359, 11.11), (-11.219, -51.176, 10.947), (-12.024, -51.013, 10.808), (-12.837, -50.87, 10.691), (-13.655, -50.748, 10.597), (-14.479, -50.646, 10.523), (-15.307, -50.567, 10.469), (-16.137, -50.51, 10.433), (-16.969, -50.476, 10.414), (-17.802, -50.463, 10.409), (-18.635, -50.474, 10.419), (-19.467, -50.507, 10.44), (-20.298, -50.563, 10.472), (-21.126, -50.642, 10.513), (-21.952, -50.744, 10.562), (-22.774, -50.869, 10.618), (-23.591, -51.017, 10.68), (-24.404, -51.188, 10.748), (-25.211, -51.38, 10.821), (-26.013, -51.595, 10.897), (-26.808, -51.83, 10.978), (-27.597, -52.085, 11.061), (-28.379, -52.359, 11.146), (-29.154, -52.651, 11.233), (-29.923, -52.96, 11.32), (-30.685, -53.286, 11.407), (-31.44, -53.627, 11.493), (-32.189, -53.983, 11.577), (-32.931, -54.353, 11.658), (-33.666, -54.738, 11.737), (-34.395, -55.135, 11.811), (-35.117, -55.545, 11.881), (-35.833, -55.966, 11.946), (-36.542, -56.4, 12.006), (-37.245, -56.844, 12.06), (-37.942, -57.299, 12.109), (-38.632, -57.764, 12.151), (-39.316, -58.238, 12.186), (-39.995, -58.72, 12.215), (-40.669, -59.21, 12.235), (-41.337, -59.708, 12.249), (-42.001, -60.211, 12.254), (-42.661, -60.72, 12.25), (-43.317, -61.233, 12.238), (-43.971, -61.75, 12.215), (-44.622, -62.268, 12.183), (-45.272, -62.788, 12.139), (-45.921, -63.308, 12.084), (-46.569, -63.828, 12.015), (-47.217, -64.345, 11.933), (-47.865, -64.86, 11.835), (-48.513, -65.371, 11.72), (-49.161, -65.877, 11.588), (-49.81, -66.378, 11.437), (-50.458, -66.873, 11.266), (-51.106, -67.36, 11.074), (-51.754, -67.838, 10.861), (-52.402, -68.307, 10.627), (-53.049, -68.766, 10.371), (-53.694, -69.213, 10.092), (-54.338, -69.648, 9.7916), (-54.98, -70.07, 9.4687), (-55.619, -70.478, 9.1237), (-56.255, -70.872, 8.7567), (-56.887, -71.251, 8.3682), (-57.514, -71.616, 7.9587), (-58.136, -71.965, 7.5289), (-58.753, -72.299, 7.0795), (-59.365, -72.617, 6.611), (-59.97, -72.919, 6.1244), (-60.568, -73.205, 5.6202), (-61.16, -73.475, 5.0995), (-61.745, -73.728, 4.5629), (-62.322, -73.965, 4.0113), (-62.893, -74.185, 3.4457), (-63.457, -74.389, 2.867), (-64.014, -74.575, 2.2762), (-64.564, -74.746, 1.6741), (-65.108, -74.9, 1.062), (-65.646, -75.038, 0.44072), (-66.178, -75.16, -0.18849), (-66.706, -75.267, -0.82444), (-67.23, -75.36, -1.4659), (-67.75, -75.439, -2.1117), (-68.269, -75.505, -2.7605), (-68.787, -75.559, -3.4108), (-69.307, -75.6, -4.0611), (-69.829, -75.629, -4.7098), (-70.355, -75.647, -5.3553), (-70.889, -75.654, -5.9955), (-71.43, -75.649, -6.6287), (-71.983, -75.633, -7.2524), (-72.547, -75.607, -7.8644), (-73.126, -75.57, -8.4624), (-73.721, -75.524, -9.0438), (-74.334, -75.469, -9.606), (-74.965, -75.405, -10.146), (-75.615, -75.335, -10.662), (-76.285, -75.257, -11.151), (-76.975, -75.174, -11.61), (-77.683, -75.086, -12.039), (-78.41, -74.995, -12.435), (-79.154, -74.9, -12.798), (-79.913, -74.803, -13.128), (-80.684, -74.704, -13.425), (-81.468, -74.603, -13.69), (-82.26, -74.501, -13.925), (-83.061, -74.399, -14.132), (-83.867, -74.296, -14.314), (-84.679, -74.192, -14.473), (-85.493, -74.088, -14.612), (-86.311, -73.985, -14.735), (-87.13, -73.881, -14.845), (-87.951, -73.777, -14.944), (-88.773, -73.673, -15.037), (-89.595, -73.57, -15.126), (-90.417, -73.467, -15.212)], dxfattribs=attribsp)
# Save the DXF file
doc.saveas('polyline.dxf')
Any help would be greatly appreciated!

Large Datsample: failing to better visualize data point using matplotlib plot

The size of the data samples is very large, making it difficult to visualise the data points using a matplotlib plot.
Sample Code:
import matplotlib.pyplot as plt
plt.plot(myList_timestamps, myList_fitnessValues)
plt.xlabel('Timestamps (seconds)')
#plt.xticks(range(1, 51)
#plt.xticks(range(1, 53, 5))
plt.ylabel('WATT - MSU Fitness Values')
plt.title('Evolutionary Optimization - Execution Time')
plt.show()
Output:
I have 9113 candidates solutions as data samples to plot against 9113 data samples as fitness values. How should I plot this large data using python to better visualize the data?
Data Sample:
myList_timestamps = [[0.06160092353820801,
0.07070684432983398,
0.0794517993927002,
0.08730483055114746,
0.09506797790527344,
0.10278487205505371,
0.11050796508789062,
0.11819696426391602,
0.12598776817321777,
0.13364410400390625,
0.1412339210510254,
0.14882898330688477,
0.15642499923706055,
0.16405892372131348,
0.171644926071167,
0.17924880981445312,
0.1868269443511963,
0.1943988800048828,
0.2020108699798584,
0.21060776710510254,
0.219498872756958,
0.22813701629638672,
0.23638296127319336,
0.24529194831848145,
0.25347185134887695,
0.26166296005249023,
0.2696189880371094,
0.2773740291595459,
0.2849307060241699,
0.2925240993499756,
0.30014586448669434,
0.3077728748321533,
0.31533288955688477,
0.32283592224121094,
0.3303370475769043,
0.3378570079803467,
0.34534668922424316,
0.352841854095459,
0.36031174659729004,
0.3678579330444336,
0.3753628730773926,
0.3828439712524414,
0.3903648853302002,
0.39795589447021484,
0.40547990798950195,
0.412992000579834,
0.42046594619750977,
0.42803382873535156,
0.435579776763916,
0.44308996200561523,
0.450577974319458,
0.45802807807922363,
0.4655318260192871,
0.4730229377746582,
0.48052191734313965,
0.488048791885376,
0.49558186531066895,
0.5031087398529053,
0.5106048583984375,
0.5181560516357422,
0.525662899017334,
0.5331556797027588,
0.5406389236450195,
0.5481007099151611,
0.5555720329284668,
0.563060998916626,
0.5705769062042236,
0.578115701675415,
0.5856177806854248,
0.5931298732757568,
0.6006178855895996,
0.6081528663635254,
0.6156718730926514,
0.6231448650360107,
0.6306188106536865,
0.6381428241729736,
0.6456358432769775,
0.6531088352203369,
0.6606647968292236,
0.6682088375091553,
0.6756858825683594,
0.6832168102264404,
0.6907000541687012,
0.6981749534606934,
0.7056229114532471,
0.7130780220031738,
0.7205479145050049,
0.728065013885498,
0.7355530261993408,
0.743027925491333,
0.7505538463592529,
0.7580459117889404,
0.7654819488525391,
0.7729947566986084,
0.7804989814758301,
0.7879579067230225,
0.7954659461975098,
0.8029458522796631,
0.8104219436645508,
0.8179588317871094,
0.8254818916320801,
0.8329558372497559,
0.840451717376709,
0.8479418754577637,
0.8554189205169678,
0.8629167079925537,
0.8704218864440918,
0.8782069683074951,
0.8857617378234863,
0.8933010101318359,
0.9008169174194336,
0.9083929061889648,
0.9159009456634521,
0.923414945602417,
0.9309487342834473,
0.9386038780212402,
0.9461567401885986,
0.9536347389221191,
0.9610898494720459,
0.9685368537902832,
0.9759769439697266,
0.983414888381958,
0.9908480644226074,
0.9982888698577881,
1.0057227611541748,
1.01314377784729,
1.0205698013305664,
1.0280189514160156,
1.035449743270874,
1.0429389476776123,
1.0503628253936768,
1.0578010082244873,
1.0658130645751953,
1.0734107494354248,
1.081054925918579,
1.0888869762420654,
1.0964579582214355,
1.1040010452270508,
1.1115117073059082,
1.1190118789672852,
1.1264939308166504,
1.1339750289916992,
1.141474723815918,
1.1489946842193604,
1.156526803970337,
1.164029836654663,
1.1716160774230957,
1.1790966987609863,
1.1865930557250977,
1.1940937042236328,
1.2019388675689697,
1.2094628810882568,
1.216930866241455,
1.2243878841400146,
1.2318336963653564,
1.2393128871917725,
1.2467608451843262,
1.2542097568511963,
1.2619950771331787,
1.2704198360443115,
1.2786128520965576,
1.2871167659759521,
1.2947309017181396,
1.302293062210083,
1.309783697128296,
1.3177897930145264,
1.3256456851959229,
1.3331577777862549,
1.340836763381958,
1.348417043685913,
1.355942964553833,
1.3635058403015137,
1.3709850311279297,
1.3785638809204102,
1.3860559463500977,
1.3935277462005615,
1.4009969234466553,
1.408479928970337,
1.415954828262329,
1.423440933227539,
1.4309158325195312,
1.4383947849273682,
1.4458889961242676,
1.453355073928833,
1.4608356952667236,
1.468317985534668,
1.4757959842681885,
1.4833028316497803,
1.4908149242401123,
1.4983007907867432,
1.505788803100586,
1.5132827758789062,
1.520780086517334,
1.5282917022705078,
1.5357389450073242,
1.5432488918304443,
1.5507168769836426,
1.5581979751586914,
1.565687656402588,
1.5731756687164307,
1.58066987991333,
1.5881669521331787,
1.5956358909606934,
1.6031649112701416,
1.6106679439544678,
1.6181929111480713,
1.6265389919281006,
1.634814977645874,
1.6424179077148438,
1.6499037742614746,
1.657348871231079,
1.6648588180541992,
1.6722848415374756,
1.6797456741333008,
1.6871848106384277,
1.6946487426757812,
1.7022688388824463,
1.7098469734191895,
1.7173528671264648,
1.724863052368164,
1.73232102394104,
1.7397880554199219,
1.7472498416900635,
1.7546827793121338,
1.762143850326538,
1.7696146965026855,
1.777108907699585,
1.7845828533172607,
1.7920348644256592,
1.7994859218597412,
1.806952953338623,
1.8144299983978271,
1.8218896389007568,
1.8293559551239014,
1.8368110656738281,
1.8442790508270264,
1.851726770401001,
1.8592119216918945,
1.86667799949646,
1.8741397857666016,
1.8815827369689941,
1.8890256881713867,
1.8964788913726807,
1.9039208889007568,
1.911383867263794,
1.918832778930664,
1.9262988567352295,
1.9337799549102783,
1.94124174118042,
1.948828935623169,
1.9562938213348389,
1.9637949466705322,
1.9712047576904297,
1.9786548614501953,
1.986097812652588,
1.9935338497161865,
2.000976800918579,
2.0084168910980225,
2.016091823577881,
2.023655891418457,
2.031132936477661,
2.038616895675659,
2.0460739135742188,
2.053546905517578,
2.060973882675171,
2.0684218406677246,
2.0758438110351562,
2.083289861679077,
2.0906968116760254,
2.0981409549713135,
2.1055638790130615,
2.1129748821258545,
2.1203808784484863,
2.1278228759765625,
2.1352219581604004,
2.1426548957824707,
2.1502327919006348,
2.1577627658843994,
2.165205955505371,
2.1726489067077637,
2.180156946182251,
2.1876187324523926,
2.195056915283203,
2.202542781829834,
2.210002899169922,
2.217458963394165,
2.2249059677124023,
2.232353925704956,
2.2398228645324707,
2.247271776199341,
2.2547237873077393,
2.262202739715576,
2.269657850265503,
2.277296781539917,
2.284979820251465,
2.2924628257751465,
2.2999508380889893,
2.3074228763580322,
2.3148908615112305,
2.3223717212677,
2.329817771911621,
2.3372578620910645,
2.34472393989563,
2.3521809577941895,
2.359632968902588,
2.367115020751953,
2.374567985534668,
2.382063865661621,
2.38950777053833,
2.3970019817352295,
2.404465913772583,
2.4119558334350586,
2.4194018840789795,
2.4268767833709717,
2.4343249797821045,
2.441788911819458,
2.4492337703704834,
2.45668888092041,
2.4641637802124023,
2.471620798110962,
2.479109764099121,
2.48657488822937,
2.494025945663452,
2.501471996307373,
2.508949041366577,
2.5164427757263184,
2.523920774459839,
2.531388998031616,
2.53886079788208,
2.5463309288024902,
2.5537829399108887,
2.5612847805023193,
2.568727731704712,
2.576223850250244,
2.583711862564087,
2.591172933578491,
2.598625898361206,
2.6060757637023926,
2.6135129928588867,
2.621011972427368,
2.628448963165283,
2.635972738265991,
2.643435001373291,
2.650902032852173,
2.6583468914031982,
2.665862798690796,
2.673314094543457,
2.680816888809204,
2.688267946243286,
2.6957550048828125,
2.7032127380371094,
2.7106738090515137,
2.7181079387664795,
2.725554943084717,
2.732996940612793,
2.740450859069824,
2.747886896133423,
2.7553389072418213,
2.7627639770507812,
2.7702107429504395,
2.777662992477417,
2.7851169109344482,
2.7925288677215576,
2.80000376701355,
2.8074288368225098,
2.8148789405822754,
2.8223319053649902,
2.8297858238220215,
2.8372128009796143,
2.84466290473938,
2.852128028869629,
2.85958194732666,
2.8670127391815186,
2.8744797706604004,
2.8819189071655273,
2.8893797397613525,
2.896803855895996,
2.9042470455169678,
2.911679983139038,
2.919153928756714,
2.9266068935394287,
2.9340579509735107,
2.9415018558502197,
2.9490177631378174,
2.9564428329467773,
2.9638688564300537,
2.9712448120117188,
2.9786460399627686,
2.986050844192505,
2.9934427738189697,
3.0008530616760254,
3.0082297325134277,
3.015631914138794,
3.023007869720459,
3.030390977859497,
3.0377516746520996,
3.04512882232666,
3.052503824234009,
3.0598559379577637,
3.067525863647461,
3.074979782104492,
3.082453966140747,
3.089857816696167,
3.0973098278045654,
3.104733943939209,
3.1121609210968018,
3.11958384513855,
3.1270148754119873,
3.1344220638275146,
3.141826868057251,
3.1492297649383545,
3.1566479206085205,
3.1641108989715576,
3.1720409393310547,
3.18062686920166,
3.188631772994995,
3.19647479057312,
3.2040579319000244,
3.211491823196411,
3.2189619541168213,
3.2264137268066406,
3.2338807582855225,
3.241302013397217,
3.248771905899048,
3.256213903427124,
3.263671875,
3.2710888385772705,
3.2785208225250244,
3.285946846008301,
3.293437957763672,
3.3010239601135254,
3.3086907863616943,
3.3162219524383545,
3.3237030506134033,
3.3311376571655273,
3.3386118412017822,
3.3460726737976074,
3.3535208702087402,
3.3609509468078613,
3.368414878845215,
3.3758559226989746,
3.3833189010620117,
3.3907477855682373,
3.3982179164886475,
3.405695915222168,
3.413137912750244,
3.420606851577759,
3.4280447959899902,
3.435490846633911,
3.4429378509521484,
3.4504079818725586,
3.4578518867492676,
3.4652678966522217,
3.4726951122283936,
3.4801628589630127,
3.4876327514648438,
3.4950459003448486,
3.502520799636841,
3.5099668502807617,
3.5174667835235596,
3.5249149799346924,
3.532382011413574,
3.5398058891296387,
3.547271966934204,
3.554724931716919,
3.5621488094329834,
3.5695910453796387,
3.5770299434661865,
3.5844788551330566,
3.5919089317321777,
3.599360942840576,
3.6068217754364014,
3.6142799854278564,
3.6217379570007324,
3.6291840076446533,
3.636641025543213,
3.6440939903259277,
3.651533842086792,
3.658979892730713,
3.6664540767669678,
3.67389178276062,
3.681334972381592,
3.688839912414551,
3.6963768005371094,
3.7038447856903076,
3.711305856704712,
3.718761920928955,
3.726195812225342,
3.7336368560791016,
3.741126775741577,
3.7485568523406982,
3.7559916973114014,
3.763450860977173,
3.770900011062622,
3.778341770172119,
3.785810947418213,
3.7932307720184326,
3.800668954849243,
3.808100938796997,
3.8155479431152344,
3.82303786277771,
3.8304550647735596,
3.8379018306732178,
3.845344066619873,
3.852766990661621,
3.860213041305542,
3.867640733718872,
3.8750839233398438,
3.8825418949127197,
3.8900070190429688,
3.897446870803833,
3.9049458503723145,
3.9123809337615967,
3.919834852218628,
3.927325963973999,
3.934762954711914,
3.9422247409820557,
3.9497127532958984,
3.957167863845825,
3.9645960330963135,
3.972066879272461,
3.9795138835906982,
3.9869298934936523,
3.9943947792053223,
4.001836776733398,
4.0092689990997314,
4.016718864440918,
4.0241899490356445,
4.031642913818359,
4.039106845855713,
4.046592950820923,
4.05404806137085,
4.061479806900024,
4.068920850753784,
4.076357841491699,
4.083805799484253,
4.0912556648254395,
4.098691701889038,
4.106162786483765,
4.1136109828948975,
4.121060848236084,
4.128498792648315,
4.135960817337036,
4.143415689468384,
4.15084171295166,
4.158272981643677,
4.16582989692688,
4.173282861709595,
4.180737733840942,
4.188170909881592,
4.195602893829346,
4.203077793121338,
4.210502862930298,
4.2179529666900635,
4.225406885147095,
4.232857704162598,
4.240309000015259,
4.247731924057007,
4.255206823348999,
4.262646913528442]
myList_fitnessValues = [1.177397872785327,
1.1838368070851042,
1.198426283830517,
1.1971495165606483,
1.1300637485336795,
1.2187992912454821,
1.2145353817939883,
1.0729413153620015,
1.2521284084941269,
1.2183068116189408,
1.195634989638366,
1.1613388860470966,
1.2217006054348303,
1.206234560770683,
1.2372446068751055,
1.187058775523,
1.1872546511295015,
1.1966112517544802,
1.2145107120984742,
1.2421864845871378,
1.1890153127520433,
1.1674951340729436,
1.2251505016710167,
1.1958552931582382,
1.2080607542394712,
1.201035514597457,
1.092659066061191,
1.2306418318602446,
1.1995437445068218,
1.2449192292367206,
1.2106208502011808,
1.2112721352650087,
1.1196669840676667,
1.1134332262454683,
1.1197768644022856,
1.2261263457543805,
1.231366828628176,
1.2196350828703688,
1.08741318320004,
1.2032137535738274,
1.2024228903569536,
1.2137572975032105,
1.0738592164216931,
1.1738526733756591,
1.1544974613440897,
1.160844467172908,
1.2187677280979918,
1.162505454897613,
1.2021549705530339,
1.229063908531223,
1.214924462090727,
1.1411833735549284,
1.1883797211741252,
1.1342311436728563,
1.2194421521815677,
1.1237953059433416,
1.185322478323287,
1.1688528378709393,
1.138039592406455,
1.1855580350049484,
1.2303222163698007,
1.2140360262028758,
1.09912727836326,
1.0982013456663848,
1.2074961979865895,
1.2130674992213648,
1.1064772919391566,
1.2183787053226458,
1.2387016873859218,
1.1316362444070998,
1.0955985789217237,
1.2295510887027803,
1.2321228706728062,
1.2291667095487586,
1.1943183790667353,
1.1806877475400122,
1.0821097661565597,
1.1885871916833606,
1.2287827776186633,
1.1245075536475073,
1.246567313324614,
1.1968924804246073,
1.2357189468661003,
1.0798212767853532,
1.210981845170037,
1.1949578119730175,
1.0745447494722138,
1.1842984199966768,
1.1885233082136473,
1.1404877293427729,
1.176750616683678,
1.2322331744279031,
1.2008328893267939,
1.1839763301938666,
1.1740540064695157,
1.1215709455350205,
1.1838699168837248,
1.2190806980658488,
1.2187178223617976,
1.188198435991883,
1.2420874742392598,
1.1936975325903234,
1.145645140863139,
1.1896439998849606,
1.0901724022621744,
1.2214054198855253,
1.202183913330283,
1.2214232388980968,
1.2451547757149166,
1.1542504637802762,
1.2150818383252948,
1.1551718106916113,
1.180265276583371,
1.2259447669065064,
1.23970172148869,
1.2195702465867029,
1.2121212076750423,
1.1196861951049026,
1.084233317578786,
1.2184195145467944,
1.2019297900082373,
1.2197546777584807,
1.1806877475400122,
1.1935874583246553,
1.1947324698675565,
1.1949174251388859,
1.1859323990481676,
1.0906342354229615,
1.1176255050944655,
1.1496417617749741,
1.214221309853014,
1.1871680736265695,
1.1915179673491303,
1.2025838867023781,
1.197499571598236,
1.1366803103334713,
1.2085395261620986,
1.211657983876409,
1.2119904284994945,
1.1499635839213362,
1.2048809684531807,
1.18988003425591,
1.162958419973022,
1.2117707427085584,
1.1243944753618493,
1.1744385678325748,
1.1903600159926122,
1.2016224458259388,
1.211296343777177,
1.1349759574949243,
1.0718396654449382,
1.1964735952940981,
1.2321228706728062,
1.240538488513929,
1.137008792662425,
1.118080518441783,
1.2179995323083854,
1.2332167673456187,
1.2299392260321718,
1.229455434517842,
1.0945646172721897,
1.1684574384092985,
1.2216592587636825,
1.1473954661560457,
1.0972316717042851,
1.2069927716927877,
1.145655054243576,
1.1709533542017871,
1.2399276594736448,
1.0571702762640665,
1.1289925835126173,
1.1978661608433139,
1.1751549861474675,
1.189320827332064,
1.114652077172573,
1.0855461561951376,
1.114545327811882,
1.213725567748654,
1.20353452440095,
1.1820774536021856,
1.186462718947463,
1.1889690769217898,
1.2018835746505774,
1.211090224753304,
1.1831781914671817,
1.1773466438721967,
1.197092394238814,
1.2041535500147282,
1.163132237400184,
1.168563226082197,
1.1678829662040073,
1.1363664937760698,
1.1083990267935506,
1.2031778809291547,
1.0676216251859287,
1.2177599264089978,
1.0990307312997643,
1.21049553896777,
1.1599270669137582,
1.2328076437831437,
1.0972099959852455,
1.2158413254752458,
1.1858591862647971,
1.160354488282236,
1.1885987402151457,
1.242744809392655,
1.180804379621974,
1.1948754664090295,
1.1999708176480794,
1.0863273779101585,
1.1865571118556641,
1.2247520706088966,
1.1902065318111597,
1.1769933798289114,
1.1908864309517615,
1.2057410331253477,
1.2364890730379687,
1.1663675183275037,
1.1088393200653563,
1.20706966917313,
1.2442896235721,
1.1069454133505705,
1.2628901213116968,
1.1207013243831028,
1.1582247278576716,
1.0708548471205084,
1.2155678255250282,
1.1986370029163065,
1.1459855041681286,
1.2054266674604792,
1.192257639008284,
1.197672089140054,
1.198202892392417,
1.1025040708024108,
1.121321746966252,
1.2149674581109837,
1.2123920496821512,
1.227103878165898,
1.189101851528379,
1.253525044950779,
1.2498189114548643,
1.173845452730351,
1.2083118238298576,
1.2030549929175092,
1.2271213348837007,
1.1478325884552891,
1.1960780932197772,
1.1902259956766275,
1.2467831992009593,
1.0792760733500293,
1.1869221700876043,
1.0824793309140637,
1.1955662830576248,
1.1080499423655457,
1.2006240107240815,
1.0880807583848786,
1.2157448455744477,
1.1521531149930204,
1.240280892270902,
1.1238415805874602,
1.1828435837181859,
1.1712592947196425,
1.2137283926841305,
1.2424701024482705,
1.2263538380098462,
1.2070290285031617,
1.1631224185724471,
1.0794787639871248,
1.093670630714558,
1.1265887464291346,
1.2318408943741077,
1.1936771541321396,
1.2169441544187152,
1.198506382581772,
1.186458880174174,
1.2103524823669856,
1.2285778509901992,
1.1200216208405227,
1.1387896672101574,
1.0908173539816957,
1.2308851210556966,
1.2035466664307617,
1.1001905414241768,
1.1424185494658932,
1.2269161990482325,
1.1999656325314627,
1.1967207679880325,
1.1600771097377474,
1.2069027992929418,
1.1385148138423051,
1.1489017335157772,
1.1068267732858115,
1.2205880980904533,
1.218044294574066,
1.2529730847546638,
1.186660925630313,
1.2060697606531923,
1.2045284746581517,
1.1642166388713013,
1.1103498769950435,
1.1756364918041724,
1.1065195117330475,
1.185722908999943,
1.2160505306065248,
1.1583256484574564,
1.1826392418072076,
1.178493074752072,
1.1177123697895326,
1.2412795138296302,
1.2170991263240316,
1.1378564491277,
1.2598329438516054,
1.1594168596923815,
1.067412768958962,
1.0681905031107433,
1.1088495388520627,
1.2260312346475448,
1.1845181121770647,
1.0908462423974803,
1.2254157975354272,
1.1726057354383534,
1.2463105895418234,
1.1938360058317639,
1.1809949387357708,
1.214965669951487,
1.1806096453015262,
1.2120442182541238,
1.2039396191666214,
1.2241011795101584,
1.1835653941636586,
1.1872311824740118,
1.2049867769183018,
1.1032492996465715,
1.2459948771640978,
1.210714791333494,
1.2017638381896383,
1.2082205245581055,
1.2100706475737704,
1.1777593480571773,
1.2463816959419804,
1.1956288937602344,
1.2250384673113388,
1.2232925845822948,
1.2271097732217437,
1.2041158407114751,
1.1731142176012719,
1.089562181699617,
1.2065580430236436,
1.1286176112592208,
1.214260708902002,
1.100397749837259,
1.1634968104491086,
1.2031492654249205,
1.241916873584268,
1.128692464375822,
1.2438405074344832,
1.221942545955605,
1.2122284632985285,
1.2196872139542247,
1.1963958742294165,
1.211163602848183,
1.1876392875222728,
1.1120181290701372,
1.1928622611586417,
1.2310597744441403,
1.0909886287400576,
1.1746761873370748,
1.086400046407615,
1.1948938617215121,
1.237389733833963,
1.2002584041594944,
1.1634829773569397,
1.1560999466513606,
1.1517515881362235,
1.18561959209192,
1.1243333063590204,
1.168110787112396,
1.252233283674239,
1.1809616018853473,
1.1172192014427276,
1.065718486758231,
1.1735702052275503,
1.2319344426459806,
1.2406551834164845,
1.134545708488982,
1.212394683299605,
1.0839740327133316,
1.154921467945748,
1.1868420784058569,
1.27846759456701,
1.1337877151557247,
1.2090680051988998,
1.111959785928736,
1.2162877159119596,
1.2617090658101289,
1.0746368205192902,
1.082494892236285,
1.12003079427392,
1.2349350980294647,
1.2079171758399385,
1.1540805938938137,
1.1904244522100265,
1.0925561509117376,
1.1130713817081679,
1.1996791615125522,
1.1953376557177446,
1.1721740496775683,
1.1498018407550115,
1.2189399864150035,
1.2174001512005672,
1.1841444791371007,
1.185707384067646,
1.1818600419697818,
1.1487639315280984,
1.187990790473883,
1.2070236352846957,
1.183120704393338,
1.2131486529878408,
1.2230034850431808,
1.2598577318052009,
1.222494513225296,
1.1989335894352298,
1.133213715468035,
1.137460808129861,
1.24270509873175,
1.1877173094601927,
1.2104442602106054,
1.2230272768431958,
1.1848372792316968,
1.1892502628879684,
1.2035024239408367,
1.1289245106213106,
1.1547680583390754,
1.1817062724464646,
1.07460992973405,
1.2424105540969468,
1.2006706347201768,
1.1469299638380548,
1.2003475049998125,
1.2628425996056627,
1.1704529581521437,
1.2318309803876157,
1.0800513855721836,
1.228251341459926,
1.20519927398022,
1.2026116263341706,
1.2267213579299914,
1.1944767555176976,
1.0973340714559194,
1.199844572870176,
1.2167600163050747,
1.1973706771935049,
1.1274929727743968,
1.1847494081385286,
1.2179786952027045,
1.2103068524172256,
1.1648972358845942,
1.2012871447601516,
1.0806169290790832,
1.0638847843439245,
1.1523924483632424,
1.2163186571317048,
1.2318610477915777,
1.1790869269637845,
1.1800511479858375,
1.1828738610906249,
1.1414027009085952,
1.2239157840282788,
1.2163662161977793,
1.0777765284762604,
1.1871756186016387,
1.191419398750568,
1.2077786982792487,
1.1306928350191163,
1.2219862084208202,
1.1704952108872595,
1.1350341511093405,
1.2382530787288621,
1.197672089140054,
1.1634636863060297,
1.2198105693727255,
1.1738029086162305,
1.1866104828955661,
1.2050422293564858,
1.0986376515523584,
1.1639928343093937,
1.22645365263098,
1.0831783532562473,
1.1793732758175444,
1.2095496760640134,
1.1933309580469191,
1.0970298786458046,
1.1494963511728211,
1.1967270644046457,
1.2344818441993706,
1.2272379509433546,
1.1112370068652921,
1.221504646323395,
1.2374620707520216,
1.1180642101127265,
1.2499150575244404,
1.1306307576694052,
1.2043884061922128,
1.2148802673894985,
1.1818496551780364,
1.256060021892613,
1.1922912062142983,
1.1902422382130782,
1.1992276134291726,
1.1710757539172894,
1.123994660195365,
1.2214993644613943,
1.155215069374298,
1.1086344864348479,
1.0910943060265557,
1.2191511677776559,
1.210061225791385,
1.177381635100414,
1.181486384213164,
1.165494009707241,
1.1963931772967231,
1.2102493016491176,
1.101845863755783,
1.2104131731458112,
1.2496346326865795,
1.1918641349127161,
1.2362974006491536,
1.2055345356030078,
1.2285741635823975,
1.2335964200302294,
1.2299260975739024,
1.252639296531916,
1.1816404229058095,
1.0906166413304024,
1.2083432826502967,
1.198686258537757,
1.1415695127122047,
1.092894116614261,
1.2066842100186415,
1.156538986861618,
1.2474806142885053,
1.2187478225293684,
1.2316920790783128,
1.2105404142792078,
1.2045940601752774,
1.1231347496689397,
1.1047593741136272,
1.18129835095779,
1.1835647508539222,
1.2450528028358812,
1.2222158604224076,
1.2150490929276319,
1.1816927028319475,
1.1823015755626682,
1.2708857606096744,
1.1919272687522717,
1.199215576802391,
1.2235538374085948,
1.2001199439086292,
1.1730857828737784,
1.209032518532766,
1.240920756903906,
1.102814033624564,
1.218812306587527,
1.1996553618634807,
1.179606921083769,
1.2017295317409378,
1.2330407322845536,
1.1187392156488476,
1.225736440475797,
1.0995456254389886,
1.1398239919352195,
1.2035675444496818,
1.1586383728042269,
1.2287334286814806,
1.195581908342988,
1.182475780454091,
1.1987430360427977,
1.216557035654513,
1.1996494907287538,
1.2383901831314694,
1.1531934815518878,
1.229216103794829,
1.2106112336572799,
1.1849778997346532,
1.18237184590969,
1.2009038458812764,
1.0961585804850271,
1.178040774021339,
1.1722305560727864,
1.2280646936758626,
1.1730878580889061,
1.1798127065856396,
1.224173817391561,
1.2065293766499958,
1.1997898485636171,
1.2424004246290328,
1.1717570065002927,
1.2338402423416157,
1.2494056527462882,
1.2188644637313981,
1.2212661458082938,
1.2339544318944837,
1.1071211607425422,
1.1606278890869028,
1.2189699753534322,
1.180272917562664,
1.1426456950772235,
1.0522788530258245,
1.1829427275613456,
1.2262188308828839,
1.2251773195743205,
1.1956258209753046,
1.2114920876892714,
1.1953916820234736,
1.23382398473895,
1.1582401755284804,
1.191629137388988,
1.2178006337369847,
1.251136439760085,
1.1365976380520602,
1.174275078234959,
1.0808087704223992,
1.2032740733244425,
1.2103517133973012,
1.11326005536463,
1.1909349869585562,
1.2212796832585389,
1.1075096790834102,
1.2498229141296608,
1.084664865732375,
1.1683357564539953,
1.2082937933568851,
1.252239384886692,
1.2241448948948157,
1.2220195905349323,
1.0755183739777228,
1.2246287887655924,
1.203941883586293,
1.1242510612918695,
1.2235007768884452,
1.1730788382137691,
1.0994391409748683,
1.223672903798066,
1.1273787876886823,
1.2387058055283537,
1.2136671563285772,
1.204874914999746,
1.1863124400411849,
1.2194323539365215,
1.139574455552127,
1.1883768406708517,
1.2000846688283575,
1.1745314981161292,
1.2216393545756357,
1.148559186473642,
1.1276502268015958,
1.1678501220114077,
1.248042556728196,
1.1528823530190904,
1.182349952140096,
1.202872559373987,
1.057656133683926,
1.196122637100774,
1.2031121605191817,
1.1634951499402728,
1.2095000735625363,
1.1901826500944825,
1.1705303635565636,
1.221904684759513,
1.2008426805755377,
1.2191513614245515,
1.2383835946927975,
1.1822466263148794,
1.2000277251766025,
1.0675643227701521,
1.2229772647360104,
1.082493154489034,
1.178347854805873,
1.1940673459489852,
1.1946568831787179,
1.219277339137701,
1.135039734235405,
1.2539824081361624,
1.2267246222664205,
1.0960629129827957,
1.2130669354862218,
1.2300957041596126,
1.1573830982698168,
1.096123662648259,
1.2477729284441184,
1.2135638836890315,
1.220630164390247,
1.2162877159119596,
1.2090167543426475,
1.187489906720505,
1.2275503381344637,
1.1086754622565136,
1.1618707919314104,
1.1070407212315239,
1.1923226787718677,
1.0900666694354006,
1.2262690661499525,
1.2056761416930777,
1.2458301275482253,
1.1732441231849604,
1.2211117817426773,
1.1948872902367709,
1.130818495246797,
1.2026206008072473,
1.2067040095784871,
1.1913340391980174,
1.2398675486238038,
1.1780518996775449,
1.1806804473198347,
1.2154433988507445,
1.2041310140780057,
1.1948521569436659,
1.1658255171990985,
1.2146852320116623,
1.2174547247773808,
1.2307680369014695,
1.1682623391256952,
1.2188082178033945,
1.2423527542349246,
1.13230783361083,
1.2097691357097797,
1.2047969399649594,
1.1517698102978422,
1.2065252124817711,
1.0985349880573572,
1.1426104372808603,
1.2351760150170086,
1.1902473719724727,
1.1791482059371399,
1.1185800577890548,
1.1774186347558009,
1.2397017660770022,
1.1932399219346395,
1.1009298704332167,
1.1104128735371144
]
How should I plot this large data using python to better visualize the data?
A simple and common method to get a better overview about this kind of data is to calculate the moving average (mainly it to see if there are any trends). See this post for different approaches to calculate the moving average in python.
Note 1: You need to decide how much you want to smooth the data by setting a parameter (called N here). You might have to play around a little with N to see which value best suits your data.
Note 2: By calculating the moving average the length of you data changes (it gets N-1 shorter). So the timestamp values must also be shortened.
Using the sample data from the question and choosing N=51:
import numpy as np
N = 51
myList_fitnessValues_ma = np.convolve(myList_fitnessValues, np.ones(N)/N, mode='valid')
myList_timestamps_ma = myList_timestamps[int((N-1)/2):-int((N-1)/2)]
plt.plot(myList_timestamps_ma, myList_fitnessValues_ma)
plt.xlabel('Timestamps (seconds)')
plt.ylabel('WATT - MSU Fitness Values (moving average)')
plt.title('Evolutionary Optimization - Execution Time')
plt.show()

show cluster of point with folium

I have a dataframe with a list of coordinates. I want to group on the map near points and show a dot on the map with the number of points on it like this. I'm using geopandas and folium. Following this example this is my code
from folium.plugins import MarkerCluster
import geopandas as gdp
from shapely.geometry import Point, LineString, Polygon, MultiPoint
building_list = [(-1,-1),(10.6,-1),(10.6,4.4),(-1,4.4)]
building = Polygon(building_list)
gdf_building = gpd.GeoDataFrame({'building':['Building'], 'geometry':[building]})
locations = df[['x', 'y']]
locationlist = locations.values.tolist()
print(locationlist)
map_building = gdf_building.explore(style_kwds={'color':'black','weight':3,'fillColor':'gray','fillOpacity':0.2})
marker_cluster = MarkerCluster().add_to(map_building)
#add a marker to the cluster, not the map
for location in locationlist:
marker = folium.Marker(
location=location,
)
marker_cluster.add_child(marker)
folium.LayerControl().add_to(map_building);
map_building
this is the result of the print of the location list, as you can see there are actual points.
[[-10.975653734125247, 14.223493380357969], [-3.0008170610241343, 4.952113879109663], [1.2889747510247407, 2.204612243849062], [1.8083739029012205, 1.7796964504195971], [3.420669729369738, 0.7404826646612623], [4.754666507090696, -0.5524039121778554], [5.53171781359429, 1.310518688820813], [4.318223656736064, -0.8753972819321212], [1.389494271129264, 16.407899298913147], [2.82329764017852, 0.9072912833977023], [-4.497070654458373, 11.375240775117195], [4.388070857027747, 2.026226808689793], [5.020759388491676, 2.756120554023195], [6.001047947560095, 3.640750189810609], [4.748181698919979, 0.6264535181440452], [2.6528944739060116, 3.4802260546999184], [0.6549886054089478, 2.3877498852531], [0.9196638849958464, 2.150417536934342], [5.108903278970173, 1.7149961891938221], [4.023317826279737, -0.7706685254504961], [0.903562864987411, 2.0796324380334292], [1.9513434378658632, 1.3693238231850704], [5.644520571004791, 0.9779979070472828], [4.885749810717222, 1.8987377699798547], [0.8962029416395766, 2.1062557612048933], [4.8, 3.1279064752127708], [-0.04508236022751255, 3.0568571249844774], [4.800000000000001, 1.9140378892025933], [-1.989743839191096, 3.371668995303246], [1.1656083298774806, 1.807252953229595], [1.8713291261582097, 1.143179456971009], [4.874256276815991, 1.442130685409675], [1.4180968883141027, 1.6105182232356952], [3.190937527417693, 0.7681078921163724], [0.6152561767926022, 2.4352310754461803], [4.943357091884491, 1.3116890391870286], [4.669880127812657, -0.9679152111322677], [3.614139957564433, 4.902972429576663], [5.669098065784623, 3.913649249046372], [3.813973864130181, -0.7323384613836201], [-0.5199470910058632, 4.940176537119433], [0.6045522916902855, 2.4454362761206676], [3.997321854441272, -0.40367758748908944], [-0.7749524129532896, 3.7357518435721646], [4.398949303156029, 1.5109906728678215], [0.3021200538833131, 2.729947426419629], [5.644520571004791, 1.1699695341101362], [0.3021200538833131, 2.729947426419629], [4.038514768738497, -0.2998527712422736], [5.463665551081531, 4.137680366555347], [0.8962029416395773, 2.157030296469887], [3.4127967638900434, -0.15739477788275646], [5.3627337631140914, 0.47173132205910173], [-17.039850506402114, 17.631059209559115], [4.693589821903688, 2.645652867319201], [1.652915853616594, 1.4812029360906247], [0.7676072335427175, 2.7523632254899515], [5.108903278970173, 1.6583572860511704], [0.4132781963362031, 2.904134388098682], [3.259934813790278, -0.18044453177741993], [0.8945938791669944, 2.1032269377270914], [2.57881016023833, 3.112861191160806], [3.592593833132784, 1.4836895239891579], [3.317682346796072, -0.406574363983617], [5.23674698889199, -0.4896527267915487], [1.652915853616594, 1.3490348417130233], [4.085742861634555, 0.6349594490258132], [4.0072168062713, -1.0764854252471776], [3.9664315265442545, -0.39306568870652514], [0.6031981581824843, 2.377481733947807], [3.6039665183706195, -0.2228663982705159], [1.8714318174071345, 1.1838500546775474], [1.8733352672556218, 1.1469557225661375], [6.102634326393458, 10.469900068262838], [5.520832421942425, 2.46410701016014], [1.1747275757821485, 1.930301474093356], [4.67585787292738, 0.636918779066237], [4.491096721029827, 1.397978478475737], [1.4568609922766316, 1.6834859483416318], [0.6098506962014651, 2.302784409097839], [4.324311646727075, 2.936569893754537], [0.9333579831295232, 2.088974913476743], [4.518788267677348, 0.020784625382443522], [0.47410395349115, 4.18998422562209], [1.1656853374503982, 1.7606554558367773], [1.837995743774393, 4.916814195653471], [4.388070857027747, 2.3671414910993596], [4.174911828673442, -0.6971612141229651], [0.6031981581824846, 2.357970915575524], [1.2974476846606793, 3.9025406503211726], [-0.03437847512519587, 2.924380280250848], [4.174911828673442, -0.6971612141229651], [1.4936152461189462, 7.123830497692014], [0.6152561767926021, 2.2589820889454635], [-11.279626246016324, 13.226577973666835], [1.82048818578873, 4.061094403724194], [4.581484036209459, 5.890145802013782], [4.265190300374529, 2.452440089435306], [3.8845082501175248, -0.7686579417306034], [0.9637552343186307, 2.2334130180125245], [4.25063438297424, -0.843761982823303], [0.98431156175139, 4.194028317706987], [1.1761611467009938, 1.827117079015031], [5.449834811820658, 0.5594950288780689], [1.6724495566887114, 4.605197843492187], [3.5384417352877477, 0.07911340357174579], [4.348620907925173, -0.9172910153848934], [1.2159563418949306, 4.6362987571816525], [1.1668919640810418, 1.4915162635203172], [2.249924886746646, 5.685012235183888], [4.067409175602521, -0.536439926621362], [2.5656813438853296, 2.7056802874632795], [2.1293914647589034, 4.642559399432756], [3.4127967638900434, -0.24461452723904076], [4.346665070906969, 7.334655181225893], [4.8, 2.0482018725377187], [1.123738605408948, 3.57856337675828], [4.228966634584813, -0.5954109912309717], [0.6031981581824846, 2.2362846421499483], [2.347165380094789, 2.914571054618481], [4.388070857027747, -0.4566421607253668], [2.1979928248704255, 1.0832058812097898], [1.69634605871611, 3.8274151057051444], [1.123738605408948, 3.57856337675828], [1.1747275757821485, 1.7776761397553662], [4.4693615246118945, -0.6333756573025302], [4.53293914647589, -0.9077879799922597], [1.0361298628314102, 4.036083757910509], [2.808234500789304, 0.3071881706888375], [-0.7191638996712912, 7.874957048525548], [2.8260583427385293, 7.660845787800426], [3.9912416391547496, 2.8264553465726032], [2.1123464147922975, 3.1439793965288794], [2.6731182859013067, 0.26597049531016737], [1.1673676524343146, 1.4924116768911837], [4.121463981513893, -0.5859228214803203], [1.4342741983539433, 1.6004923338374206], [4.608830245519423, 1.4005010543426653], [0.9162643526136969, 2.1035411206240853], [1.215956341894931, 4.30182011239446], [1.4872582434657393, 1.5371751490903258], [4.388070857027747, 2.4052170210761252], [0.6031981581824842, 2.4125336286506642], [2.898777190073906, 0.7105093578091037], [0.8945938791669943, 2.1382788324299487], [5.669098065784624, 3.8755737190696062], [6.070148762628594, 0.206906059620394], [1.4568609922766318, 1.4079768509137702], [5.531717813594291, 1.830541309334829], [-1.2471810710311697, 8.743462266446604], [0.6248686316291862, 2.4533251080797505], [3.6748906604483524, 3.124197444178624], [4.893093462225972, 0.4590567027245811], [1.1657585899617324, 1.9134186772549258], [-0.024766020288611745, 3.0296940622407025], [2.3563295257006565, 0.7846312919685801], [5.205353859395272, 0.42210603989954754], [3.8437689822722936, -0.7665448437321474], [3.6748906604483524, 3.1628631330266517], [2.727173091812678, 0.639131207705715], [1.788002622023866, 6.769502536197556], [-0.4057970441397616, 3.2929812953755766], [4.965546187085682, 1.9531004552217803], [-0.046436493735313444, 2.9484252862795244], [2.9371084106171184, 0.20309215819430038], [4.707852582126202, 2.17957929497331], [1.1778166085718507, 1.6671813846379329], [2.683868551208399, 0.5036394358913796], [4.8, 2.0482018725377187], [-2.145131239743776, 4.923667400169843], [4.5024200674231105, 2.3840119264621733], [1.9101959213696633, 1.1695980304271996], [-0.40643138475388163, 3.4467173934044606], [4.259451940886286, 1.0691802220180708], [1.167367652434315, 1.7378040719362537], [1.4872582434657393, 1.700227006989037], [1.6528426011052597, 1.2481771593670978], [4.800000000000001, 2.005728687048103], [-0.04508236022751255, 3.0568571249844774], [2.3439911949358385, 3.5683856892327976], [3.910730421098827, 4.135332344591893], [-0.04508236022751233, 2.9509742434706796], [2.950134753881053, -0.04379815575361201], [4.264382707965382, 0.09902519561511669], [3.106229402999044, 3.7294157226465066], [-0.0247660202886113, 2.989216765708611], [2.1123464147922975, 3.1385816622847216], [1.652915853616594, 1.3022923888888307], [4.259451940886286, 1.0000167752411318], [1.5290924648042203, 4.310240411834759], [2.9371084106171184, 0.20309215819430038], [-2.0852792308147365, 5.03633000521274], [0.2726285121062364, 5.866558412092897], [0.2900620352731951, 2.6721980849212557], [5.108903278970173, 1.6233053913483126], [-0.8239196028969407, 5.030419621266199], [1.8466237141828281, 5.932927653853168], [4.8, 9.658382640793699], [2.950134753881053, 0.22761233374994183], [0.6045522916902855, 2.238833599341103], [2.486105104523525, 7.000796957374647], [0.98431156175139, 4.168919529596836], [-0.8239196028969404, 5.026413025884784], [0.2990310210936111, 2.6018611324034016], [0.6803390498603128, 3.601707913302718], [1.2974476846606788, 3.8503187512101014], [0.8267571383654448, 5.853058068771931], [-0.04482743126273103, 2.87869356247465], [3.2764894324988463, 0.1688700457664547], [-3.767329514700993, 8.66269152688608], [3.222434626587475, -0.03359997239130541], [4.090573653616875, -0.707077359146127], [3.8849164987684937, -0.3938707427571062], [-0.5199470910058632, 5.609801167360874], [5.233045406042793, 1.6406297256739135], [1.5290924648042197, 4.299156029478217], [-0.024766020288611745, 3.0296940622407025], [4.325545325536228, 0.3438574274307671], [0.11249999999999938, 4.508574043613446], [5.15613137186623, -0.3461798183284306], [3.192037375398367, -0.3082514746327818], [0.6031981581824848, 2.469172531793316], [4.0682821864057095, 1.190912989505398], [1.0228149047709139, 5.191509904245847], [0.8267571383654444, 5.861370182915128], [-0.3692763432639352, 3.4022034406151067], [2.285674165981368, 0.40054508668958766], [2.9582532190128603, 2.1211932808694134], [-2.5837485905052917, 9.06294581359145], [-1.9853601848610753, 8.508068840069502], [1.8745211272980575, 1.30411808065442], [0.2862090792517309, 4.825957160184751], [3.0627533820148227, 0.592225673986793], [-0.046436493735313444, 3.103355437229105], [5.205353859395272, 0.7111054161797834], [7.244188130715516, 1.6376585614535513], [1.0228149047709136, 5.216618692355997], [4.074211060786516, 0.932690737783997], [0.4381746991919173, 6.21878271740584], [1.2159563418949306, 3.8495970971114977], [1.4151343263934582, 3.2980753742742706], [3.295606407946904, 0.3243530680371258], [6.0564497139770435, 0.4578939096082548], [-0.7634664185075604, 5.151411845004738], [2.6731182859013067, 0.6900063191517116], [0.34384052085180405, 3.92734467412126], [-0.7966228863999916, 3.730012258845936], [-1.343379060194661, 6.639339649156551], [2.655747377976134, 0.7579169337318432], [0.4741039534911502, 4.183751019358796], [0.8106024824996589, 3.8469096688591344], [4.251583853701234, -0.5122336159174341], [5.433641521339686, 1.2304496491736634], [0.6098506962014656, 2.4407786937191167], [2.958196315583629, 0.42169758533305535], [0.4741039534911502, 4.186979702946429], [3.139194465647819, 7.372362643090272], [6.070148762628594, 3.5839417724562916], [0.34384052085180405, 3.9447824700656744], [-0.024766020288611745, 3.0647459569435602], [0.98431156175139, 4.194028317706987], [3.205063718662302, 0.1665897376282075], [2.249924886746646, 5.685012235183888], [0.2862090792517309, 4.857299154558197], [0.894593879166995, 1.8996977832962885], [1.1883610918565954, 5.485872011543561], [3.956287021404356, 2.025822005622866], [0.020600968107850726, 6.546459784906801], [3.4988012781265745, 3.3537031044984764], [-0.044827431262731476, 2.9919314062894187], [2.4005561755536413, 4.351152383512192], [1.5888434056451888, 2.39808430763285], [3.724642241260815, 1.5993834520787418], [2.0763857262800003, 1.0305473880108813], [3.847522797914033, 1.4837311634639483], [1.8745211272980573, 1.224717120939789], [5.752477202085966, 2.161171990200467], [0.8945938791669943, 2.1382788324299487], [3.233184891894567, 0.19323849790749126], [1.6649738722267118, 1.4776151700223363], [4.677119443346781, 3.3876549706623997], [-0.395982428616346, 3.3114558657725937], [0.6630501671115239, 1.7966830293255285], [3.769512705456301, -0.4277218437869408], [1.4180968883141025, 1.7446822065708214], [4.345201751603508, 1.0003858818660745], [0.8962029416395768, 2.019036011848609], [6.7767023598214795, 2.767717033817918], [5.811238605408949, 10.971775430203346], [0.8945938791669944, 2.1032269377270914], [3.2362710203269964, 0.7662217764717181], [2.4400930748564438, 0.44511030500033666], [2.9431537290560565, 0.43585531382959397], [0.2900620352731951, 2.707249979624113], [4.692497346929079, 0.1733884621768529], [0.8988112239109582, 2.225618323427335], [3.997321854441272, -0.4340312777679376], [3.825695452069068, 2.5535046832593484], [-0.7966228863999916, 3.760365949124784], [3.657528247574082, -0.2364971741873707], [10.728301112968886, 8.129684856516427], [3.2764894324988463, 0.30103814014405605], [-0.2848242861634557, 2.5492067505157534], [3.4972488209905226, 0.0015738001887335429], [6.1942908897012146, 2.957238766835977], [4.499254404787959, 0.8703367099355468], [1.5413130493771106, 1.8775064211159793], [-0.3745113733554064, 3.4274011610281363], [3.1948017901428534, 0.4679448192780584], [4.010305839061002, -0.7770054557893282], [0.8962029416395773, 2.124411983277796], [4.499254404787959, 0.8703367099355468], [4.213823144644389, -0.9389793892200413], [6.898694746008462, 11.99606251173315], [2.333165047686302, 0.9445567230782452], [0.2916710977457775, 2.710278803101915], [-0.5199470910058637, 5.594291058917969], [-8.768059849208484, 13.375959505727446], [-2.2942634638312485, 7.933801838660646], [1.6545249160891764, 1.1890118072921148], [-4.551431127611951, 9.141286955528566], [5.633568473455744, -0.10132487706078885], [0.98431156175139, 4.194028317706987], [-0.7191638996712908, 7.827132937551404], [1.8379957437743928, 4.909616201353765], [10.59608346486909, 12.797203128699032], [0.8267571383654444, 5.861370182915128], [0.21177072258842733, 6.987152345891302], [3.6719651469590926, 9.249671380027745], [7.556358345958318, 7.050258822639192], [-1.450881713265581, 6.478776935187961], [2.9371084106171184, 0.3253638022534422], [2.950134753881053, 0.4292849375237151], [2.478857178818972, 0.8132979823825846], [-0.6936561702575947, 5.275621376822615], [-6.31581424528901, 12.58751873434882], [0.8267571383654444, 5.861370182915128], [3.2050637186623017, 0.07489893978269802], [0.8267571383654444, 5.861370182915128], [-0.12731794307864375, 10.43702448814638], [0.6031981581824843, 2.290261984591522], [1.1883610918565952, 5.528235044517281], [-2.8148523126150256, 10.46228804188221], [3.4127967638900434, -0.15739477788275646], [-0.10237335992179664, 5.223023803192105], [-1.214196617484058, 3.9467738427772825], [-0.10237335992179664, 5.216790596928811], [0.1292714202217442, 5.652827830140181], [-1.4285166649520677, 7.991178815631317], [1.0179268928460212, 6.234650333088625], [-0.10237335992179664, 5.216790596928811], [0.8945206266556602, 1.961891958849074], [-3.7645455411158375, 14.965007331606095], [-2.5837485905052926, 9.084689128297647], [-0.6936561702575943, 5.28281937112232], [0.2900620352731955, 2.6903543069941582], [0.4741039534911502, 4.186979702946429], [1.3593134337794222, 4.90314287805327], [-1.754854225156658, 5.917020061280331], [-0.2760824391735279, 4.896042006953552], [-2.145131239743776, 4.999196591404791], [3.6039665183706195, -0.2719136677062992], [5.97912131397371, 0.7637993559893621], [4.166698914141367, -0.08485018099479191], [4.893093462225972, 0.30016716961001455], [0.2900620352731951, 2.6721980849212557], [-3.6991068907737716, 8.861726191348053], [-0.046436493735313444, 2.9484252862795244], [-0.024766020288611523, 2.9666860241457513], [4.827116471079473, -0.5364894629472379], [-1.2141966174840584, 4.087970934575141], [2.2617088319942518, 0.21893988925413344], [4.18147880047027, 0.19511841248959838], [5.9280348530409075, 8.890736658315404], [4.518788267677348, -0.04154743725049981], [4.44325205928394, -1.007852334000157], [4.290841041213988, -0.17540461714051325], [3.769294411555624, -0.34168885793470505], [4.632658506364657, 0.3070575811701284], [4.388033904986031, -1.2787941827568412], [2.8796602146258485, 0.7169976483376705], [-8.993302706302629, 18.047614948808622], [-0.40804044722646404, 3.32923571550917], [4.388524835038002, -0.22441713017397236], [5.9749455766628685, -0.5105871937116166], [0.2900620352731954, 2.6317207883891633], [0.8945938791669943, 2.1382788324299487], [-16.642526220238658, 19.623895964392474], [-0.046436493735313444, 2.9484252862795244], [0.6031981581824842, 2.4125336286506642], [3.9771730838489914, -0.7757922401415804], [4.536770649420184, -0.20454374589753987], [0.2900620352731951, 2.707249979624113], [-0.4080404472264636, 3.4209265133546793], [4.719384382974241, -0.48143166216084854], [4.544248150302466, -0.5884133974848607], [2.768366006109903, 0.9183434148624996]]
The problem is that when i display map_building I see only the map of the first polygon without any point. How to solve it?
I think its perhaps a problem that you dont have a folium map. In the docs of GeoDataFrame.explore() it says the parameter m should be linked to a map. Perhaps first you have to create a map and then use it in the explore command. Similar to this (have not tried this example in lack of geopandas installed)
map_building = gdf_building.explore(style_kwds={'color':'black','weight':3,'fillColor':'gray','fillOpacity':0.2},
m=folium.Map(location=[44, -73], zoom_start=5))
I am not aware of the advantages of GeoDataFrame.explore() vs. pure folium. Perhaps, if you do not need it, you can just create a folium map and add the markercluster to it, just like it is done in your linked example. This should work:
# create map
m = folium.Map(location=[44, -73], zoom_start=5)
marker_cluster = MarkerCluster().add_to(m)
# add a marker to the cluster, not the map
for location in locationlist:
marker = folium.Marker(location=location)
marker_cluster.add_child(marker)
# add layercontrol
folium.LayerControl().add_to(m);
# show map
m

Scatter plot looks good but line plot looks weird on non-monotonically increasing data set

I have a monotonically increasing data set as shown below.
R,M
7.0868,1.8102943986273166
7.087,1.810312919954896
7.0872,1.8102755711577103
7.0875,1.8102573284176724
7.0876,1.810237664390435
7.0887,1.810218897273047
7.0891,1.8102001649403308
7.0893,1.810178092508343
7.0894,1.8101553469354064
7.0902,1.8101359159985828
7.0907,1.810114549302785
7.0913,1.81009305646246
7.0916,1.8100731291478405
7.0919,1.8100505894431602
7.0923,1.8100245482326576
7.0933,1.810004843857531
7.0941,1.809981589365771
7.0948,1.8099565489521152
7.0949,1.8099337348073137
7.0957,1.8099052572558645
7.096,1.8098801233168886
7.0963,1.8098547472451978
7.0968,1.8098277762241366
7.0976,1.8098018568760064
7.0988,1.8097719856008248
7.099,1.8097424026714641
7.0994,1.8097145467653863
7.1002,1.8096846260698558
7.1005,1.8096553317621344
7.1016,1.8096207945226712
7.1023000000000005,1.8095909693292185
7.1031,1.8095572406207299
7.1038,1.8095238119406782
7.1043,1.8094894673202357
7.1053,1.8094538233723965
7.1064,1.8094182142472666
7.1067,1.8093818127358254
7.1079,1.8093437811755255
7.1088000000000005,1.8093041362243816
7.1098,1.809264041823682
7.1107000000000005,1.8092243783159143
7.1112,1.8091814057573945
7.1126000000000005,1.8091391534332957
7.1136,1.809094359509292
7.1148,1.809048533354942
7.1158,1.8090036536620597
7.1169,1.8089557015211883
7.1181,1.8089046493876206
7.1193,1.8088552101687183
7.1204,1.8088020551150032
7.1219,1.808747338797958
7.1225000000000005,1.8086919257417675
7.1247,1.8086350956553856
7.1258,1.8085748348942912
7.1275,1.808514553392964
7.1291,1.8084534203833889
7.1306,1.8083867543300092
7.1325,1.8083196215972281
7.1338,1.80825088250088
7.136,1.808178483206244
7.1374,1.8081044657602499
7.1392,1.8080287144430973
7.1412,1.8079480881686774
7.1431000000000004,1.8078648303094877
7.1456,1.8077807725153732
7.1476,1.8076892427316402
7.1503000000000005,1.807599230113512
7.1525,1.8075034794947091
7.1552,1.8074049113668145
7.1578,1.8073014641377354
7.1612,1.8071891350684717
7.1637,1.8070785128831843
7.1675,1.80696372890561
7.1701,1.8068419878230761
7.1737,1.8067122501065405
7.1779,1.8065802344915192
7.1814,1.8064383616085946
7.1856,1.806293933093177
7.1896,1.806138911817485
7.1947,1.8059806108944794
7.1993,1.80580908721362
7.2053,1.8056328160830435
7.2107,1.8054479682161961
7.2173,1.8052525284387695
7.2237,1.8050465193576883
7.2309,1.8048296381956124
7.2392,1.8045988960975694
7.2474,1.8043595071215677
7.2564,1.8041082364687364
7.2666,1.8038382553758734
7.2781,1.8035594899544896
7.2901,1.8032661790541915
7.3036,1.8029587616930072
7.3192,1.8026419692687126
7.3365,1.802313214895432
7.3559,1.8019832998820766
7.3782000000000005,1.8016547858228427
7.4039,1.8013374225262055
7.434,1.8010610354808818
7.469,1.8008525385497174
7.4728,1.8008375055547212
7.4766,1.8008241798024116
7.4805,1.8008134283846535
7.485,1.8008014895962607
7.4889,1.8007906472467445
7.4931,1.8007836940234814
7.4974,1.8007772872833665
7.502,1.8007773636348627
7.5066,1.800777214492662
7.5111,1.800772599047411
7.5161,1.8007769259270974
7.5204,1.8007812794388944
7.5251,1.8007885071607819
7.5309,1.8007961396426069
7.5354,1.800809332665
7.5404,1.800828880377808
7.5456,1.800846702941447
7.5511,1.8008692674381197
7.5565,1.8008933437321841
7.5623000000000005,1.8009237058574081
7.5682,1.800958157045992
7.5744,1.8009948449267943
7.58,1.8010363488385235
7.5863000000000005,1.8010832972433193
7.5923,1.8011350711403118
7.5989,1.8011921478121384
7.6052,1.801254330745158
7.6122000000000005,1.8013200393645774
7.619,1.801396979723438
7.6262,1.801481231944994
7.6332,1.8015680286606623
7.6412,1.8016656871159082
7.6485,1.8017686065785499
7.6562,1.8018805264670845
7.664,1.8020043241836483
7.6723,1.8021374134198185
7.6806,1.802276358227313
7.689,1.802430876035706
7.698,1.8025962404854161
7.7073,1.802773424707928
7.7165,1.8029615206656595
7.7261,1.8031700727690376
7.7358,1.8033901306600841
7.746,1.8036245439350242
7.7569,1.8038801831608258
7.7674,1.8041511397011663
7.7785,1.8044409511998807
7.7895,1.804751063391503
7.8016000000000005,1.8050889378483397
7.8137,1.8054500843221957
7.8260000000000005,1.8058344798814248
7.839,1.8062497893213036
7.8523000000000005,1.8066916535420319
7.8660000000000005,1.807171119554773
7.8801000000000005,1.8076802794778468
7.8950000000000005,1.8082299359839067
7.91,1.808815338202358
7.9256,1.8094485033102967
7.9419,1.8101332152002367
7.9588,1.8108583555324504
7.9762,1.8116377906606793
7.9942,1.812480154325305
8.013300000000001,1.8133886252401064
8.0323,1.8143645477074526
8.0526,1.8154146330511043
8.073500000000001,1.8165442307174358
8.0957,1.8177698166402039
8.1182,1.819085725400004
8.1417,1.8205097465554974
8.1664,1.8220480025653125
8.192,1.8237072998986206
8.2188,1.8255111058560254
8.2468,1.827455350126501
8.2759,1.8295663029422389
8.3064,1.831861429607547
8.3383,1.8343455967834263
8.3716,1.837047237198313
8.4065,1.8399908757968044
8.4431,1.8431886841980547
8.4816,1.846678932529894
8.5218,1.8504805320192779
8.5642,1.8546328838729316
8.6085,1.859161369210759
8.655,1.8641143534208833
8.7039,1.8695256342139759
8.754900000000001,1.875446560741857
8.8087,1.881922204419208
8.8655,1.8890064461692662
8.9244,1.8967439742289458
8.9863,1.905188505881128
9.0511,1.9143851329920027
9.1186,1.924363320273434
9.188600000000001,1.9351143409915226
9.2613,1.9466051165466298
9.3348,1.9586922001685116
9.4098,1.970987602510523
9.4882,1.9833342806468837
9.5729,1.9958205973858019
9.6658,2.008306966070422
9.6757,2.0095470086686014
9.6853,2.0107829319774146
9.6956,2.0120161755240176
9.706,2.013246638357084
9.7155,2.0144724860531107
9.726,2.01569779646471
9.7361,2.01691593463459
9.7469,2.0181299858892676
9.7574,2.019339103824116
9.768,2.0205367574186544
9.7784,2.0217329512312534
9.789200000000001,2.022924537891196
9.8004,2.024103911848606
9.8115,2.0252755733660237
9.822700000000001,2.026442290408354
9.8339,2.027595562850575
9.8451,2.0287425260513627
9.8566,2.02987789695615
9.8683,2.031004255291417
9.8802,2.0321140981371753
9.8917,2.033211262029186
9.9039,2.03429873554374
9.9159,2.035370601551793
9.9284,2.036428080910105
9.9404,2.03746680777716
9.953100000000001,2.038486511766415
9.9657,2.039488307130752
9.9784,2.040471399292025
9.9911,2.0414350165353037
10.0042,2.0423773356028083
10.0178,2.043291283530465
10.030800000000001,2.0441838862321724
10.044500000000001,2.0450464474687147
10.0585,2.0458827447198584
10.0716,2.0466886270813385
10.0859,2.047468383690954
10.0998,2.0482043647433352
10.113900000000001,2.0489096859138938
10.1285,2.0495761215721746
10.1431,2.0501996224170225
10.158,2.0507863441183343
10.173,2.05132507354447
10.1883,2.0518124042758448
10.2033,2.052257120191798
10.2188,2.052637398387419
10.2344,2.0529609887501064
10.2505,2.053231208698309
10.266300000000001,2.053430956645957
10.2827,2.0535609020452807
10.2992,2.053618768726303
10.315900000000001,2.0535986346512063
10.3324,2.053499145209982
10.3495,2.0533064233065197
10.3668,2.0530215567767636
10.3844,2.0526369031524108
10.402000000000001,2.0521636845730233
10.42,2.0515392027607855
10.4381,2.0508116828399494
10.4563,2.0499535127064785
10.4748,2.0489576534963168
10.4937,2.0478138062588847
10.5128,2.046511793430433
10.532,2.0450378909729627
10.5515,2.043383966625784
10.5714,2.0415367556333575
10.591000000000001,2.039475707572078
10.6113,2.0371915999694594
10.6318,2.034681992486926
10.6523,2.031875344830552
10.6732,2.028806016957831
10.6943,2.0254302835993974
10.7156,2.021729410221098
10.737,2.0176679331240632
10.7585,2.0132226995271503
10.7804,2.0083569404787207
10.8025,2.003033377167351
10.8245,1.9972070467548615
10.8468,1.99084498211035
10.8693,1.9838848370723352
10.8916,1.976265341594595
10.913400000000001,1.9679245337116287
10.9359,1.9587753705415543
10.958,1.9487087547075432
10.9801,1.937613087921291
11.0016,1.925359737260557
11.0228,1.911811244861433
11.043700000000001,1.896814109152176
11.0641,1.880201767746232
11.0839,1.861791757645824
11.103,1.8413880752742964
11.1143,0.6798071334659402
11.1148,0.6620484741207461
11.115400000000001,0.7308628786759206
11.1163,0.643905710436412
11.1173,0.7471776126414391
11.1188,0.6253614804987849
11.119,0.7631699685933497
11.1209,1.8187639653487393
11.121,0.7788332436619917
11.1226,0.6064184938116979
11.1233,0.7941958537153351
11.1252,0.8092591741702967
11.1277,0.5870678163436467
11.1302,0.8385380585848173
11.1326,0.8527702605010601
11.135200000000001,0.5673102326921188
11.1377,0.8804746147417499
11.138300000000001,1.7936929573835567
11.1404,0.8939630164904495
11.142800000000001,0.9072161422501497
11.1443,0.5471696019139972
11.1457,0.920255663318353
11.148,0.933064576156273
11.1506,0.9456674682901905
11.152800000000001,0.958071445468564
11.1539,1.7659104790175046
11.1555,0.9702722709283456
11.1563,0.526626294457235
11.1578,0.982282581805736
11.16,0.994125843269314
11.1625,1.005758474384689
11.1651,1.0172259729870816
11.1667,1.0285290632922044
11.1681,1.7351407435690962
11.1694,1.0396641713997514
11.1708,1.0506369116951209
11.1715,0.5057129912122545
11.1728,1.06145775881892
11.1752,1.0721969265059947
11.177100000000001,1.0826438965199432
11.178700000000001,1.0930140692041797
11.1804,1.7010859834099117
11.180900000000001,1.1032438870571097
11.1824,1.113341990904366
11.184000000000001,1.123299806468843
11.1857,1.1331296145407677
11.1873,1.1428308979922694
11.1889,1.152401698215316
11.1903,1.161856869794937
11.1904,0.48445364974714356
11.1919,1.663399436215842
11.192,1.1711910394172824
11.1934,1.1804087961074725
11.1942,1.1895091584397912
11.195500000000001,1.1985002253694752
11.1974,1.2073817550934374
11.1981,1.2161518746407876
11.199300000000001,1.2248195347259854
11.2006,1.233382363999008
11.2012,1.6217221083677575
11.201600000000001,1.2418573170671454
11.2026,1.2502123181321048
11.2036,1.2584707455312942
11.2044,1.2666389953934527
11.205300000000001,1.2747462832375793
11.2059,1.282698337211604
11.2071,1.2905889671447655
11.2075,1.2983932387539374
11.208400000000001,1.5756312874271927
11.2089,1.3061289118283488
11.2093,1.3137413392392563
11.209900000000001,1.3212844363707013
11.2105,1.3287440211738633
11.2111,1.3361240786859585
11.2118,1.3434226680704695
11.2121,1.3506419841724973
11.2127,1.35780576619357
11.2131,1.3718370881026203
11.2135,1.5246558611202008
11.213700000000001,1.364846987030096
11.214,1.5138285906034126
11.2142,1.385586125420797
11.2144,1.5083287553910607
11.214500000000001,1.5027740924000998
11.2146,1.3990472473875148
11.2147,1.491494982843448
11.2148,1.4122266556473997
11.2149,1.4187122779735373
11.215,1.392352319217516
11.2151,1.4799814651383028
11.215200000000001,1.4682238422417109
11.215300000000001,1.4056725030722297
11.2154,1.4562337169860362
11.2155,1.4251295454595927
11.2156,1.4314822279446662
R,M
7.0868,1.8102943986273166
7.087,1.810312919954896
7.0872,1.8102755711577103
7.0875,1.8102573284176724
7.0876,1.810237664390435
7.0887,1.810218897273047
7.0891,1.8102001649403308
7.0893,1.810178092508343
7.0894,1.8101553469354064
7.0902,1.8101359159985828
7.0907,1.810114549302785
7.0913,1.81009305646246
7.0916,1.8100731291478405
7.0919,1.8100505894431602
7.0923,1.8100245482326576
7.0933,1.810004843857531
7.0941,1.809981589365771
7.0948,1.8099565489521152
7.0949,1.8099337348073137
7.0957,1.8099052572558645
7.096,1.8098801233168886
7.0963,1.8098547472451978
7.0968,1.8098277762241366
7.0976,1.8098018568760064
7.0988,1.8097719856008248
7.099,1.8097424026714641
7.0994,1.8097145467653863
7.1002,1.8096846260698558
7.1005,1.8096553317621344
7.1016,1.8096207945226712
7.1023000000000005,1.8095909693292185
7.1031,1.8095572406207299
7.1038,1.8095238119406782
7.1043,1.8094894673202357
7.1053,1.8094538233723965
7.1064,1.8094182142472666
7.1067,1.8093818127358254
7.1079,1.8093437811755255
7.1088000000000005,1.8093041362243816
7.1098,1.809264041823682
7.1107000000000005,1.8092243783159143
7.1112,1.8091814057573945
7.1126000000000005,1.8091391534332957
7.1136,1.809094359509292
7.1148,1.809048533354942
7.1158,1.8090036536620597
7.1169,1.8089557015211883
7.1181,1.8089046493876206
7.1193,1.8088552101687183
7.1204,1.8088020551150032
7.1219,1.808747338797958
7.1225000000000005,1.8086919257417675
7.1247,1.8086350956553856
7.1258,1.8085748348942912
7.1275,1.808514553392964
7.1291,1.8084534203833889
7.1306,1.8083867543300092
7.1325,1.8083196215972281
7.1338,1.80825088250088
7.136,1.808178483206244
7.1374,1.8081044657602499
7.1392,1.8080287144430973
7.1412,1.8079480881686774
7.1431000000000004,1.8078648303094877
7.1456,1.8077807725153732
7.1476,1.8076892427316402
7.1503000000000005,1.807599230113512
7.1525,1.8075034794947091
7.1552,1.8074049113668145
7.1578,1.8073014641377354
7.1612,1.8071891350684717
7.1637,1.8070785128831843
7.1675,1.80696372890561
7.1701,1.8068419878230761
7.1737,1.8067122501065405
7.1779,1.8065802344915192
7.1814,1.8064383616085946
7.1856,1.806293933093177
7.1896,1.806138911817485
7.1947,1.8059806108944794
7.1993,1.80580908721362
7.2053,1.8056328160830435
7.2107,1.8054479682161961
7.2173,1.8052525284387695
7.2237,1.8050465193576883
7.2309,1.8048296381956124
7.2392,1.8045988960975694
7.2474,1.8043595071215677
7.2564,1.8041082364687364
7.2666,1.8038382553758734
7.2781,1.8035594899544896
7.2901,1.8032661790541915
7.3036,1.8029587616930072
7.3192,1.8026419692687126
7.3365,1.802313214895432
7.3559,1.8019832998820766
7.3782000000000005,1.8016547858228427
7.4039,1.8013374225262055
7.434,1.8010610354808818
7.469,1.8008525385497174
7.4728,1.8008375055547212
7.4766,1.8008241798024116
7.4805,1.8008134283846535
7.485,1.8008014895962607
7.4889,1.8007906472467445
7.4931,1.8007836940234814
7.4974,1.8007772872833665
7.502,1.8007773636348627
7.5066,1.800777214492662
7.5111,1.800772599047411
7.5161,1.8007769259270974
7.5204,1.8007812794388944
7.5251,1.8007885071607819
7.5309,1.8007961396426069
7.5354,1.800809332665
7.5404,1.800828880377808
7.5456,1.800846702941447
7.5511,1.8008692674381197
7.5565,1.8008933437321841
7.5623000000000005,1.8009237058574081
7.5682,1.800958157045992
7.5744,1.8009948449267943
7.58,1.8010363488385235
7.5863000000000005,1.8010832972433193
7.5923,1.8011350711403118
7.5989,1.8011921478121384
7.6052,1.801254330745158
7.6122000000000005,1.8013200393645774
7.619,1.801396979723438
7.6262,1.801481231944994
7.6332,1.8015680286606623
7.6412,1.8016656871159082
7.6485,1.8017686065785499
7.6562,1.8018805264670845
7.664,1.8020043241836483
7.6723,1.8021374134198185
7.6806,1.802276358227313
7.689,1.802430876035706
7.698,1.8025962404854161
7.7073,1.802773424707928
7.7165,1.8029615206656595
7.7261,1.8031700727690376
7.7358,1.8033901306600841
7.746,1.8036245439350242
7.7569,1.8038801831608258
7.7674,1.8041511397011663
7.7785,1.8044409511998807
7.7895,1.804751063391503
7.8016000000000005,1.8050889378483397
7.8137,1.8054500843221957
7.8260000000000005,1.8058344798814248
7.839,1.8062497893213036
7.8523000000000005,1.8066916535420319
7.8660000000000005,1.807171119554773
7.8801000000000005,1.8076802794778468
7.8950000000000005,1.8082299359839067
7.91,1.808815338202358
7.9256,1.8094485033102967
7.9419,1.8101332152002367
7.9588,1.8108583555324504
7.9762,1.8116377906606793
7.9942,1.812480154325305
8.013300000000001,1.8133886252401064
8.0323,1.8143645477074526
8.0526,1.8154146330511043
8.073500000000001,1.8165442307174358
8.0957,1.8177698166402039
8.1182,1.819085725400004
8.1417,1.8205097465554974
8.1664,1.8220480025653125
8.192,1.8237072998986206
8.2188,1.8255111058560254
8.2468,1.827455350126501
8.2759,1.8295663029422389
8.3064,1.831861429607547
8.3383,1.8343455967834263
8.3716,1.837047237198313
8.4065,1.8399908757968044
8.4431,1.8431886841980547
8.4816,1.846678932529894
8.5218,1.8504805320192779
8.5642,1.8546328838729316
8.6085,1.859161369210759
8.655,1.8641143534208833
8.7039,1.8695256342139759
8.754900000000001,1.875446560741857
8.8087,1.881922204419208
8.8655,1.8890064461692662
8.9244,1.8967439742289458
8.9863,1.905188505881128
9.0511,1.9143851329920027
9.1186,1.924363320273434
9.188600000000001,1.9351143409915226
9.2613,1.9466051165466298
9.3348,1.9586922001685116
9.4098,1.970987602510523
9.4882,1.9833342806468837
9.5729,1.9958205973858019
9.6658,2.008306966070422
9.6757,2.0095470086686014
9.6853,2.0107829319774146
9.6956,2.0120161755240176
9.706,2.013246638357084
9.7155,2.0144724860531107
9.726,2.01569779646471
9.7361,2.01691593463459
9.7469,2.0181299858892676
9.7574,2.019339103824116
9.768,2.0205367574186544
9.7784,2.0217329512312534
9.789200000000001,2.022924537891196
9.8004,2.024103911848606
9.8115,2.0252755733660237
9.822700000000001,2.026442290408354
9.8339,2.027595562850575
9.8451,2.0287425260513627
9.8566,2.02987789695615
9.8683,2.031004255291417
9.8802,2.0321140981371753
9.8917,2.033211262029186
9.9039,2.03429873554374
9.9159,2.035370601551793
9.9284,2.036428080910105
9.9404,2.03746680777716
9.953100000000001,2.038486511766415
9.9657,2.039488307130752
9.9784,2.040471399292025
9.9911,2.0414350165353037
10.0042,2.0423773356028083
10.0178,2.043291283530465
10.030800000000001,2.0441838862321724
10.044500000000001,2.0450464474687147
10.0585,2.0458827447198584
10.0716,2.0466886270813385
10.0859,2.047468383690954
10.0998,2.0482043647433352
10.113900000000001,2.0489096859138938
10.1285,2.0495761215721746
10.1431,2.0501996224170225
10.158,2.0507863441183343
10.173,2.05132507354447
10.1883,2.0518124042758448
10.2033,2.052257120191798
10.2188,2.052637398387419
10.2344,2.0529609887501064
10.2505,2.053231208698309
10.266300000000001,2.053430956645957
10.2827,2.0535609020452807
10.2992,2.053618768726303
10.315900000000001,2.0535986346512063
10.3324,2.053499145209982
10.3495,2.0533064233065197
10.3668,2.0530215567767636
10.3844,2.0526369031524108
10.402000000000001,2.0521636845730233
10.42,2.0515392027607855
10.4381,2.0508116828399494
10.4563,2.0499535127064785
10.4748,2.0489576534963168
10.4937,2.0478138062588847
10.5128,2.046511793430433
10.532,2.0450378909729627
10.5515,2.043383966625784
10.5714,2.0415367556333575
10.591000000000001,2.039475707572078
10.6113,2.0371915999694594
10.6318,2.034681992486926
10.6523,2.031875344830552
10.6732,2.028806016957831
10.6943,2.0254302835993974
10.7156,2.021729410221098
10.737,2.0176679331240632
10.7585,2.0132226995271503
10.7804,2.0083569404787207
10.8025,2.003033377167351
10.8245,1.9972070467548615
10.8468,1.99084498211035
10.8693,1.9838848370723352
10.8916,1.976265341594595
10.913400000000001,1.9679245337116287
10.9359,1.9587753705415543
10.958,1.9487087547075432
10.9801,1.937613087921291
11.0016,1.925359737260557
11.0228,1.911811244861433
11.043700000000001,1.896814109152176
11.0641,1.880201767746232
11.0839,1.861791757645824
11.103,1.8413880752742964
11.1143,0.6798071334659402
11.1148,0.6620484741207461
11.115400000000001,0.7308628786759206
11.1163,0.643905710436412
11.1173,0.7471776126414391
11.1188,0.6253614804987849
11.119,0.7631699685933497
11.1209,1.8187639653487393
11.121,0.7788332436619917
11.1226,0.6064184938116979
11.1233,0.7941958537153351
11.1252,0.8092591741702967
11.1277,0.5870678163436467
11.1302,0.8385380585848173
11.1326,0.8527702605010601
11.135200000000001,0.5673102326921188
11.1377,0.8804746147417499
11.138300000000001,1.7936929573835567
11.1404,0.8939630164904495
11.142800000000001,0.9072161422501497
11.1443,0.5471696019139972
11.1457,0.920255663318353
11.148,0.933064576156273
11.1506,0.9456674682901905
11.152800000000001,0.958071445468564
11.1539,1.7659104790175046
11.1555,0.9702722709283456
11.1563,0.526626294457235
11.1578,0.982282581805736
11.16,0.994125843269314
11.1625,1.005758474384689
11.1651,1.0172259729870816
11.1667,1.0285290632922044
11.1681,1.7351407435690962
11.1694,1.0396641713997514
11.1708,1.0506369116951209
11.1715,0.5057129912122545
11.1728,1.06145775881892
11.1752,1.0721969265059947
11.177100000000001,1.0826438965199432
11.178700000000001,1.0930140692041797
11.1804,1.7010859834099117
11.180900000000001,1.1032438870571097
11.1824,1.113341990904366
11.184000000000001,1.123299806468843
11.1857,1.1331296145407677
11.1873,1.1428308979922694
11.1889,1.152401698215316
11.1903,1.161856869794937
11.1904,0.48445364974714356
11.1919,1.663399436215842
11.192,1.1711910394172824
11.1934,1.1804087961074725
11.1942,1.1895091584397912
11.195500000000001,1.1985002253694752
11.1974,1.2073817550934374
11.1981,1.2161518746407876
11.199300000000001,1.2248195347259854
11.2006,1.233382363999008
11.2012,1.6217221083677575
11.201600000000001,1.2418573170671454
11.2026,1.2502123181321048
11.2036,1.2584707455312942
11.2044,1.2666389953934527
11.205300000000001,1.2747462832375793
11.2059,1.282698337211604
11.2071,1.2905889671447655
11.2075,1.2983932387539374
11.208400000000001,1.5756312874271927
11.2089,1.3061289118283488
11.2093,1.3137413392392563
11.209900000000001,1.3212844363707013
11.2105,1.3287440211738633
11.2111,1.3361240786859585
11.2118,1.3434226680704695
11.2121,1.3506419841724973
11.2127,1.35780576619357
11.2131,1.3718370881026203
11.2135,1.5246558611202008
11.213700000000001,1.364846987030096
11.214,1.5138285906034126
11.2142,1.385586125420797
11.2144,1.5083287553910607
11.214500000000001,1.5027740924000998
11.2146,1.3990472473875148
11.2147,1.491494982843448
11.2148,1.4122266556473997
11.2149,1.4187122779735373
11.215,1.392352319217516
11.2151,1.4799814651383028
11.215200000000001,1.4682238422417109
11.215300000000001,1.4056725030722297
11.2154,1.4562337169860362
11.2155,1.4251295454595927
11.2156,1.4314822279446662
The data is imported using Pandas with the code below.
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('data.txt')
df = df.sort_values(by=['R'])
plt.plot(df['R'], df['M'])
plt.gcf().set_size_inches(2.55*8,1*8)
plt.xlabel(r'$r$ $(km)$')
plt.ylabel(r'$M/M_\odot$')
plt.show()
exit()
I've shorted data short by X ('R') and it look weird where Y is not monotonically increasing as picture below
Also, if I short the data by Y ('M'), the plot doesn't look so well where X is not monotonically increasing.
Scatter plot looks as shown below.
I have no idea for an equation to fit this plot. Is there any method or package for connecting the point properly?
Edit1:
I've tried doing spline fit. The result is as below.
import numpy as np
tck = interpolate.splrep(df['R'], df['M'],)
xnew= np.linspace(min(df['R'].to_numpy()),max(df['R'].to_numpy()),1000)
ynew = interpolate.splev(xnew, tck)
plt.plot(xnew, ynew)
I guess in this particular case a solution to get the data in the desired order is to sort them by the polar angle of the points in a cartesian plane.
X = <your data>
order = np.argsort(np.arctan2(X[:,1], X[:,0]))
plt.plot(X[order,0], X[order,1])
plt.show()

How to integrate curve from data

Here are my x-values:
[2600.2 2601.2 2602.2 2603.1 2604.1 2605.1 2606. 2607. 2607.9 2608.9
2609.9 2610.8 2611.8 2612.8 2613.7 2614.7 2615.7 2616.6 2617.6 2618.6
2619.5 2620.5 2621.4 2622.4 2623.4 2624.3 2625.3 2626.3 2627.2 2628.2
2629.2 2630.1 2631.1 2632.1 2633. 2634. 2635. 2635.9 2636.9 2637.8
2638.8 2639.8 2640.7 2641.7 2642.7 2643.6 2644.6 2645.6 2646.5 2647.5
2648.5 2649.4 2650.4 2651.3 2652.3 2653.3 2654.2 2655.2 2656.2 2657.1
2658.1 2659.1 2660. 2661. 2662. 2662.9 2663.9 2664.9 2665.8 2666.8
2667.7 2668.7 2669.7 2670.6 2671.6 2672.6 2673.5 2674.5 2675.5 2676.4
2677.4 2678.4 2679.3 2680.3 2681.2 2682.2 2683.2 2684.1 2685.1 2686.1
2687. 2688. 2689. 2689.9 2690.9 2691.9 2692.8 2693.8 2694.7 2695.7
2696.7 2697.6 2698.6 2699.6 2700.5 2701.5 2702.5 2703.4 2704.4 2705.4
2706.3 2707.3 2708.3 2709.2 2710.2 2711.1 2712.1 2713.1 2714. 2715.
2716. 2716.9 2717.9 2718.9 2719.8 2720.8 2721.8 2722.7 2723.7 2724.6
2725.6 2726.6 2727.5 2728.5 2729.5 2730.4 2731.4 2732.4 2733.3 2734.3
2735.3 2736.2 2737.2 2738.2 2739.1 2740.1 2741. 2742. 2743. 2743.9
2744.9 2745.9 2746.8 2747.8 2748.8 2749.7 2750.7 2751.7 2752.6 2753.6
2754.5 2755.5 2756.5 2757.4 2758.4 2759.4 2760.3 2761.3 2762.3 2763.2
2764.2 2765.2 2766.1 2767.1 2768.1 2769. 2770. 2770.9 2771.9 2772.9
2773.8 2774.8 2775.8 2776.7 2777.7 2778.7 2779.6 2780.6 2781.6 2782.5
2783.5 2784.4 2785.4 2786.4 2787.3 2788.3 2789.3 2790.2 2791.2 2792.2
2793.1 2794.1 2795.1 2796. 2797. 2797.9 2798.9 2799.9 2800.8 2801.8
2802.8 2803.7 2804.7 2805.7 2806.6 2807.6 2808.6 2809.5 2810.5 2811.5
2812.4 2813.4 2814.3 2815.3 2816.3 2817.2 2818.2 2819.2 2820.1 2821.1
2822.1 2823. 2824. 2825. 2825.9 2826.9 2827.8 2828.8 2829.8 2830.7
2831.7 2832.7 2833.6 2834.6 2835.6 2836.5 2837.5 2838.5 2839.4 2840.4
2841.4 2842.3 2843.3 2844.2 2845.2 2846.2 2847.1 2848.1 2849.1 2850.
2851. 2852. 2852.9 2853.9 2854.9 2855.8 2856.8 2857.7 2858.7 2859.7
2860.6 2861.6 2862.6 2863.5 2864.5 2865.5 2866.4 2867.4 2868.4 2869.3
2870.3 2871.2 2872.2 2873.2 2874.1 2875.1 2876.1 2877. 2878. 2879.
2879.9 2880.9 2881.9 2882.8 2883.8 2884.8 2885.7 2886.7 2887.6 2888.6
2889.6 2890.5 2891.5 2892.5 2893.4 2894.4 2895.4 2896.3 2897.3 2898.3
2899.2 2900.2 2901.1 2902.1 2903.1 2904. 2905. 2906. 2906.9 2907.9
2908.9 2909.8 2910.8 2911.8 2912.7 2913.7 2914.7 2915.6 2916.6 2917.5
2918.5 2919.5 2920.4 2921.4 2922.4 2923.3 2924.3 2925.3 2926.2 2927.2
2928.2 2929.1 2930.1 2931. 2932. 2933. 2933.9 2934.9 2935.9 2936.8
2937.8 2938.8 2939.7 2940.7 2941.7 2942.6 2943.6 2944.5 2945.5 2946.5
2947.4 2948.4 2949.4 2950.3 2951.3 2952.3 2953.2 2954.2 2955.2 2956.1
2957.1 2958.1 2959. 2960. 2960.9 2961.9 2962.9 2963.8 2964.8 2965.8
2966.7 2967.7 2968.7 2969.6 2970.6 2971.6 2972.5 2973.5 2974.4 2975.4
2976.4 2977.3 2978.3 2979.3 2980.2 2981.2 2982.2 2983.1 2984.1 2985.1
2986. 2987. 2988. 2988.9 2989.9 2990.8 2991.8 2992.8 2993.7 2994.7
2995.7 2996.6 2997.6 2998.6 2999.5 3000.5 3001.5 3002.4 3003.4 3004.3
3005.3 3006.3 3007.2 3008.2 3009.2 3010.1 3011.1 3012.1 3013. 3014.
3015. 3015.9 3016.9 3017.9 3018.8 3019.8]
and y-values:
[-7.44466803e-04 -6.38664122e-04 -5.34609823e-04 -4.42448211e-04
-3.41690555e-04 -2.42654847e-04 -1.54987591e-04 -5.91990560e-05
2.55600336e-05 1.18132985e-04 2.09025991e-04 2.89400351e-04
3.77124735e-04 4.63193491e-04 5.39246590e-04 6.22192168e-04
7.03505639e-04 7.75298863e-04 -2.01875984e-04 9.30157920e-04
-5.76584966e-05 1.59295034e-05 8.08012121e-05 1.51379342e-04
2.20383942e-04 2.81148660e-04 3.47183293e-04 4.11664999e-04
-5.85919853e-04 -5.24369726e-04 -4.64352721e-04 -4.11642743e-04
-3.54520443e-04 -2.98912259e-04 -2.50154195e-04 -1.97405361e-04
-1.46152432e-04 -1.01298756e-04 -5.28713359e-05 -1.05509367e-05
3.50723226e-05 7.92280634e-05 1.17718164e-04 -8.94084909e-04
-8.54153425e-04 -8.19451625e-04 -7.82263155e-04 -7.46510819e-04
-7.15557404e-04 -6.82519783e-04 -6.50903801e-04 -6.23660938e-04
-5.94732888e-04 -5.69901563e-04 5.09541266e-04 -5.18787274e-04
-4.97608457e-04 -4.75397944e-04 -4.54574454e-04 6.16170144e-04
6.34369460e-04 6.51193332e-04 6.65161962e-04 6.79382903e-04
6.92239181e-04 7.02645966e-04 7.12919040e-04 7.21837433e-04
7.28708431e-04 7.35061830e-04 7.39629406e-04 7.43428919e-04
-3.07297461e-04 7.46958864e-04 7.46880284e-04 7.45469661e-04
7.43063292e-04 7.39128670e-04 -3.19316915e-04 -3.25181546e-04
7.20233508e-04 7.11143871e-04 7.01837339e-04 6.90247525e-04
6.78693826e-04 6.64610321e-04 6.49216731e-04 6.34243638e-04
6.16365002e-04 5.97180431e-04 5.78798777e-04 5.57136288e-04
5.34171219e-04 5.12389754e-04 4.86952378e-04 4.60214976e-04
4.35040369e-04 4.05834757e-04 3.78439674e-04 3.46767714e-04
3.13798203e-04 2.83016440e-04 2.47582168e-04 2.10850784e-04
1.76683478e-04 1.37487404e-04 9.69938540e-05 5.94400641e-05
1.64803804e-05 -2.77779379e-05 -6.87212380e-05 -1.15448651e-04
-1.63476655e-04 -2.07814574e-04 -2.58316150e-04 -3.04881898e-04
-3.57860800e-04 -4.12145285e-04 -4.62118682e-04 -5.18887480e-04
-5.76965937e-04 -6.30357620e-04 -6.90928891e-04 -7.52814695e-04
-8.09637384e-04 -8.74026019e-04 -9.39734858e-04 -1.00000336e-03
-1.39302040e-05 -7.64653255e-05 -1.47211271e-04 -2.19288563e-04
-2.85298568e-04 -3.59912644e-04 -4.35865855e-04 -5.05371076e-04
-5.83876630e-04 -6.63729907e-04 -7.36752757e-04 -8.19175452e-04
-9.02955255e-04 -9.79520230e-04 -1.06588804e-03 -1.15362314e-03
-1.23375682e-03 -2.68690973e-04 -3.51178179e-04 -4.44143508e-04
-5.38494735e-04 -6.24599214e-04 -7.21595167e-04 -8.19989322e-04
-9.09743181e-04 -1.01080619e-03 -1.11328051e-03 -1.20671793e-03
-1.31188675e-03 -1.41848077e-03 -4.59113905e-04 -5.68429590e-04
-6.68044666e-04 -7.80100637e-04 -8.93606563e-04 -9.97006096e-04
-1.11328198e-03 -1.23102384e-03 -2.80608069e-04 -4.01151072e-04
-5.23176860e-04 -6.34272793e-04 -7.59132433e-04 -8.85492469e-04
5.82568375e-05 -7.09712713e-05 -2.01718186e-04 -3.20694386e-04
-4.54345109e-04 4.83937944e-04 3.47359177e-04 2.09229380e-04
8.35806570e-05 -5.75154297e-05 -2.00183075e-04 7.31074418e-04
5.85400722e-04 4.38134142e-04 1.36636107e-03 1.21604716e-03
1.06411824e-03 9.25994929e-04 1.83424021e-03 1.69332288e-03
1.53518486e-03 2.43978952e-03 2.29455679e-03 2.13160111e-03
3.03249801e-03 2.88288661e-03 2.71504221e-03 3.61216191e-03
3.45810648e-03 4.35310574e-03 4.17857074e-03 5.08895105e-03
4.91110676e-03 5.81963759e-03 5.63845053e-03 6.52672784e-03
6.36053995e-03 7.24657091e-03 8.13195214e-03 7.96106363e-03
8.84414958e-03 9.72656200e-03 9.55089781e-03 1.04309645e-02
1.13103332e-02 1.22091471e-02 1.20067872e-02 1.28830348e-02
1.37792517e-02 1.46542196e-02 1.55495062e-02 1.64231655e-02
1.72960620e-02 1.81898177e-02 1.90613600e-02 2.10232224e-02
2.19165774e-02 2.27871255e-02 2.47527537e-02 2.56456629e-02
2.76146667e-02 2.95864701e-02 3.04801022e-02 3.24552956e-02
3.44570839e-02 3.64381330e-02 3.73090546e-02 3.93176951e-02
4.01883136e-02 3.99413472e-02 3.97172410e-02 3.83507327e-02
3.69832945e-02 3.45288224e-02 3.31609323e-02 3.06840301e-02
2.71317309e-02 2.46628156e-02 2.21965029e-02 2.08567884e-02
1.94892933e-02 1.81480845e-02 1.78733224e-02 1.75962456e-02
1.62501951e-02 1.59686819e-02 1.67795042e-02 1.65219970e-02
1.62336140e-02 1.59428341e-02 1.56790710e-02 1.53836971e-02
1.50858840e-02 1.48157546e-02 1.45132663e-02 1.53347956e-02
1.39316877e-02 1.36219595e-02 1.33410446e-02 1.30265037e-02
1.27094074e-02 1.24218231e-02 1.20998289e-02 1.06805433e-02
1.03861716e-02 1.00565924e-02 9.72436664e-03 8.32959359e-03
7.99229514e-03 7.68642420e-03 6.25169507e-03 5.90654091e-03
5.59355915e-03 5.24318304e-03 4.89003437e-03 3.47870860e-03
3.12024578e-03 2.75896150e-03 2.43137920e-03 2.06468706e-03
1.69512373e-03 1.36004754e-03 9.84981135e-04 6.06993019e-04
2.64291109e-04 -1.19296827e-04 -4.67067393e-04 -8.56319352e-04
-1.57470803e-04 -5.13089904e-04 -9.11112209e-04 -1.31219422e-03
-5.83499839e-04 -9.90445890e-04 -1.40050508e-03 -6.78741650e-04
-1.09476716e-03 -4.19269184e-04 -7.99266490e-04 -1.28638967e-04
-5.14130274e-04 1.51560600e-04 -2.83100227e-04 4.21200445e-04
1.07979970e-03 6.35578391e-04 1.33364405e-03 1.98499815e-03
1.53105139e-03 2.22274354e-03 1.76233437e-03 1.29849487e-03
1.98245206e-03 1.51203930e-03 1.03813746e-03 6.08625763e-04
1.28038297e-04 -3.07523898e-04 -7.94871439e-04 -1.28580703e-03
-1.73073413e-03 -2.22854468e-03 -2.73000414e-03 -2.07887167e-03
-2.58732249e-03 -1.99267690e-03 -2.45681242e-03 -1.86804972e-03
-1.71336659e-04 4.66408985e-04 2.16330903e-03 2.79823358e-03
3.37734816e-03 3.95383298e-03 5.70282896e-03 6.27564610e-03
5.72281539e-03 6.34484289e-03 5.78445904e-03 5.22006708e-03
4.70866859e-03 3.01363377e-03 2.43748942e-03 7.93751865e-04
-9.10645379e-04 -2.55893384e-03 -4.26871417e-03 -4.86473696e-03
-5.40475552e-03 -6.00879559e-03 -5.49914640e-03 -4.93107329e-03
-4.42706670e-03 -3.92612623e-03 -3.36556562e-03 -2.87038286e-03
-1.25156694e-03 -6.97404716e-04 -2.09949744e-04 1.40618052e-03
1.95380580e-03 2.43337333e-03 2.97583880e-03 3.44934833e-03
3.91956988e-03 4.45395838e-03 4.91800203e-03 4.23648918e-03
4.76133123e-03 4.07090402e-03 3.37574816e-03 2.74604376e-03
2.04183294e-03 1.33281906e-03 1.83408931e-03 1.11587836e-03
4.65318351e-04 -2.62183596e-04 -9.94613493e-04 -1.65803553e-03
-2.39990105e-03 -2.00195122e-03 -2.67843498e-03 -2.28875480e-03
-3.05028833e-03 -2.59258856e-03 -2.21508630e-03 -1.84142275e-03
-1.39322682e-03 -1.02679037e-03 -6.64262378e-04 9.30989361e-04
1.28749758e-03 1.72095891e-03 2.07002683e-03 3.57853978e-03
4.00338438e-03 4.34221377e-03 3.50941007e-03 3.92274433e-03
3.07950391e-03 3.39963667e-03 2.63098462e-03 1.77161722e-03
9.06633181e-04 1.23321618e-04 -7.52413122e-04 -3.75171969e-04
-1.26176158e-03 -2.15410634e-03 -1.79051506e-03 -1.52085428e-03
-2.43005406e-03 -2.07895302e-03 -1.82355060e-03 -2.74985271e-03
-2.41145220e-03 -2.17054397e-03 -1.93425688e-03 -4.24643055e-04
-1.95669324e-04 2.86093317e-05 3.45181395e-04 5.60606434e-04]
How would you integrate the curve from x = 2672.6 to 30005.3 in Python?
You can start out by finding the indices of your x array that are within your integral limits:
idx = np.where((np.array(x)>=2672.6) & (np.array(x)<=30005.3))[0]
And then either using np.trapz to integrate using the trapezoidal rule:
np.trapz(x=np.array(x)[idx],y=np.array(y)[idx])
or one of scipy's integration methods for integrating with fixed samples:
# same as numpy.trapz
sp.integrate.trapz(x=np.array(x)[idx],y=np.array(y)[idx])
# example using simpson's rule
sp.integrate.simps(x=np.array(x)[idx],y=np.array(y)[idx])
output:
import scipy as sp
import numpy as np
idx = np.where((np.array(x)>=2672.6) & (np.array(x)<=30005.3))[0]
>>> np.trapz(x=np.array(x)[idx],y=np.array(y)[idx])
1.4913432492153544
>>> sp.integrate.trapz(x=np.array(x)[idx],y=np.array(y)[idx])
1.4913432492153544
>>> sp.integrate.simps(x=np.array(x)[idx],y=np.array(y)[idx])
1.4892436835956682
Representing the integral:
Note, from your data, I suspect you meant the upper limit to be 3005.3 rather than 30005.3, but that's for you to decide :-)

Categories