I am trying to animate a SVG Path when the SVG element enters the viewport, I am using Locomotive Scroll on my website. I tried using data-scroll of Locomotive Scroll, which enables element detection in viewport, but unfortunately when I check the dev console of my browser I found, there is no .is-inview class applied to the SVG element when it's in the viewport.
(I tried adding data-scroll to both SVG and SVG Path, still no response).
svg {
pointer-events: none;
width: 90%;
height: 90%;
}
.path1 {
stroke-dasharray: 20030.568359375;
stroke-dashoffset: 20030.568359375;
animation: dash 2s linear forwards;
}
#keyframes dash {
to {
stroke-dashoffset: 0;
}
}
<svg xmlns="http://www.w3.org/2000/svg" data-scroll>
<g id="Layer_1">
<title>Layer 1</title>
<path d="m1285.5,318.79999c0,-1 0.38269,-2.07611 0,-3c-1.62354,-3.91968 -2.94849,-5.29871 -4,-7c-1.17554,-1.9021 -4,-4 -4,-4c-2,-1 -3.797,-3.2565 -5,-4c-2.68994,-1.66251 -4,-2 -6,-3c-4,-2 -8.05347,-5.5405 -10,-6c-4.35254,-1.0275 -10.13049,-3.48758 -15,-5c-7.27307,-2.25894 -11.1908,-2.42215 -15,-4c-5.38708,-2.23141 -8.5614,-3.89737 -14,-6c-4.75598,-1.83868 -10.7699,-2.54861 -15,-4c-4.823,-1.65482 -9.8761,-1.34314 -15,-3c-3.9231,-1.26855 -8.80566,-2.44839 -13,-4c-3.86694,-1.43048 -7.9436,-1.18835 -11,-2c-4.92822,-1.30875 -11.97412,-2.1391 -17,-3c-6.9696,-1.19385 -16.02295,-1.81128 -25,-3c-13.03906,-1.72662 -23.07666,-3.31647 -35,-4.99998c-10.0979,-1.42578 -19.93799,-4.49829 -26,-5c-5.97961,-0.49489 -13.93738,-1.3817 -25,-3c-8.96002,-1.31073 -17.63568,-3.48038 -27,-5c-9.87085,-1.60182 -20.76025,-2.08473 -32,-4c-13.83624,-2.35771 -28.89227,-3.64603 -45,-6c-18.90417,-2.76265 -38.11084,-4.67168 -58,-7c-27.27283,-3.19269 -47.00323,-7.9586 -60,-9c-12.00311,-0.96178 -26,-2 -35,-2c-8,0 -15.01257,-0.64555 -20,-1c-7.05328,-0.50127 -14,-1 -23,-1c-9,0 -26,0 -36,0c-13,0 -23.01312,0.12335 -33,-1c-8.01172,-0.90118 -19,-1 -28,-1c-7,0 -16,0 -25,0c-8,0 -16,0 -30,0c-13,0 -29,0 -37,0c-14,0 -26,0 -39,0c-13,0 -24,0 -27,0c-3,0 -10,0 -18,0c-12,0 -21,0 -32,0c-12,0 -25,0 -28,0c-4,0 -9.79025,-0.99023 -17,-2c-3.96133,-0.55481 -7,0 -9,0c-4,0 -7,0 -13,0c-6,0 -13,0 -17,0c-4,0 -13.86484,0.99594 -25,2c-7.96768,0.71844 -18,0 -23,0c-7,0 -18.01257,-0.35445 -23,0c-7.05328,0.50127 -14.94672,3.49873 -22,4c-7.97987,0.56711 -16.93796,3.49829 -23,4c-7.97275,0.65985 -11.47125,1.45877 -18,3c-1.9465,0.4595 -3.90067,1.2124 -8,3c-7.83176,3.41519 -13.15688,4.5797 -19,7c-4.13171,1.71141 -10.80901,5.32144 -14,7c-4.76599,2.50705 -9.83772,1.83772 -13,5c-1.58115,1.58115 -3.81265,3.2068 -6,5c-2.78833,2.28587 -4.59399,4.513 -7,6c-2.68999,1.66251 -5.41885,3.41885 -7,4.99998c-1.58115,1.58115 -2.186,1.69254 -4,3c-1.14726,0.8269 -4,3 -6,4c-2,1 -2.6475,2.9725 -7,4c-2.91975,0.68927 -3.066,-0.12234 -5,1c-3.11848,1.80972 -5.54916,2.95517 -9,4c-0.95709,0.28979 -3.37202,1.3851 -7,4c-3.44181,2.48071 -5.69255,5.186 -7,7c-2.48071,3.4418 -4.81266,4.20682 -7,6c-2.78832,2.28589 -5.21168,3.71411 -8,6c-2.18734,1.79318 -5.61105,2.92807 -8,5c-1.68925,1.46509 -2.82108,5.29871 -6,7c-0.88168,0.47186 -2,3 -4,5c-2,2 -2,4 -4,6c-1,1 -1.67963,3.02582 -2,5c-0.50654,3.12143 -1,5 -1,8c0,4 0,5 0,11c0,3 1,5 4,11c3,6 5,10 10,15c5,5 8.55798,10.58408 15,15c8.492,5.82114 15.87392,10.20764 24,15c8.86828,5.23007 20.34281,11.18661 33,17c13.41728,6.16251 26.95572,9.60611 42,17c10.95497,5.38409 24.28275,10.17593 37,15c11.29753,4.28552 23.11809,10.3754 30,12c9.23305,2.17963 19,5 26,6c7,1 16.14862,4.01242 26,6c13.33282,2.68997 23.88699,8.41913 38,12c8.93637,2.2674 19.85974,6.69373 38,10c13.91293,2.5358 26.42401,3.96326 37,6c8.83762,1.70197 13.66708,1.94373 21,4c6.80844,1.90921 16.05994,3.02252 24,4c8.18442,1.00754 17.02335,3.78909 27,5c7.01956,0.85199 13.04199,2.58362 25,4c13.06165,1.54706 28.04547,3.68457 43,6c17.05939,2.64136 30.1239,3.14172 44,5c11.30084,1.51337 23.96259,4.49939 34,5c13.9826,0.69739 29,3 44,3c4,0 19,1 36,1c18,0 33.97327,-0.49969 48,-1c13.99109,-0.49902 30.9458,-3.46021 46,-5c13.96283,-1.42816 28.95514,-1.2793 53,-5c20.96368,-3.24396 39.13416,-4.64539 56,-7c18.26196,-2.54956 32.08368,-4.41711 48,-7c15.09955,-2.45032 30.0174,-3.30261 44,-4c10.03741,-0.50061 23.27783,-0.7796 40,-4c6.21045,-1.19601 23.98938,-5.06992 37,-7c13.98901,-2.07523 26.88733,-5.37668 33,-7c9.85645,-2.61752 16.04504,-3.84842 23,-6c6.04199,-1.86917 13.1853,-3.36743 21,-6c7.21729,-2.4313 13.21509,-5.36078 20,-8c10.4198,-4.05313 17.89172,-6.19577 25,-10c5.91443,-3.16531 13.08557,-4.83469 19,-8c7.10828,-3.80423 12.80237,-5.84024 18,-9c4.27246,-2.59732 6,-7 11,-11c5,-4 9,-8 13,-11c4,-3 7.93787,-6.04733 11,-10c3.92139,-5.06186 7.94006,-7.37537 11,-13c1.51123,-2.7778 4.98157,-5.71201 6,-11c0.37817,-1.9639 1.28857,-3.86829 3,-8c1.21021,-2.92157 1,-6 1,-7c0,-2 1,-5 1,-8c0,-2 0,-5 0,-9c0,-4 0,-8 0,-10c0,-2 0,-4 0,-6c0,-2 0.24438,-5.01498 0,-7c-0.50378,-4.09222 -0.51941,-5.03873 -1,-8c-0.50659,-3.12143 -2,-4 -4,-8c0,0 -2.34619,-3.70547 -4,-6c-1.3075,-1.814 -3.22278,-3.724 -7,-7c-3.20508,-2.77979 -8.70251,-7.56351 -14,-10c-2.87292,-1.32138 -7.94336,-3.14774 -13,-5c-5.93872,-2.17538 -9.13306,-2.56952 -13,-4c-4.19434,-1.55161 -9.13306,-1.56952 -13,-3c-4.19434,-1.55161 -11,-3 -18,-4c-7,-1 -14,-2 -24,-4c-5,-1 -10.0304,-1.80615 -17,-3c-5.02588,-0.8609 -10.01257,-1.64557 -15,-2c-7.05322,-0.50125 -13.17419,-1.25079 -19,-3c-9.43286,-2.83221 -18.96289,-5.17505 -28,-7c-10.95911,-2.21309 -19.12842,-4.57259 -27,-5.99998c-8.40686,-1.52446 -15.19153,-3.09081 -22,-5c-7.33289,-2.05627 -17.95435,-4.13977 -30,-8c-12.95264,-4.15086 -29.08154,-6.66628 -42,-10c-14.09833,-3.63821 -34.16943,-7.22525 -45,-10c-9.19,-2.35445 -24.00464,-6.95045 -35,-8c-10.00439,-0.95494 -22.81824,-2.9407 -36,-5c-11.89728,-1.85863 -26.02838,-1.70387 -38,-3c-15.0448,-1.62885 -32.01526,-1.14449 -56,-2c-14.02673,-0.50032 -33.00885,-0.46756 -49,-1c-15.02496,-0.50027 -28,-2 -43,-2c-15,0 -29.90662,-0.99806 -46,-2c-13.97296,-0.86992 -28.00684,0.43686 -42,0c-16.02344,-0.50024 -31,-3 -44,-3c-12,0 -28,0 -42,0c-16,0 -27,0 -37,0c-10,0 -20,0 -29,0c-8,0 -22.91425,0.49083 -33,2c-9.93921,1.48724 -19,2 -31,2c-8,0 -12.83551,1.99399 -22,3c-10.93433,1.20029 -25,0 -38,0c-13,0 -24,3 -34,3c-17,0 -28.03018,1.14934 -40,2c-14.10655,1.00252 -26.01503,3.91182 -38,6c-11.0144,1.91907 -15.897,5.53873 -25,7c-9.92284,1.59288 -17.05533,2.85641 -25,6c-12.0881,4.78308 -18,8 -25,12c-7,4 -13.50433,6.59399 -18,9c-4.9875,2.66924 -7.22273,6.72398 -11,10c-1.06837,0.92659 -4.57111,5.67946 -9,7.99998c-2.80108,1.46762 -5.71412,7.21167 -8,10c-1.79319,2.18735 -3.22054,4.83127 -7,10c-2.12819,2.91046 -4.34619,6.70547 -6,9c-3.92236,5.44199 -4.5635,8.70251 -7,14c-2.64276,5.74594 -2.83504,8.00681 -3,10c-0.50171,6.06204 -1.2669,14.04495 -2,20c-0.50377,4.09222 -1,9 -1,13c0,4 -1.60853,11.16339 0,19c1.53127,7.46024 3.67121,12.21262 7,17c3.65543,5.25717 5.8819,10.07278 9,15c3.85613,6.09344 6.10436,12.5145 11,20c4.27493,6.53644 11.15359,15.82532 18,22c11.74148,10.58951 20,14 26,18c6,4 13.78357,7.46585 22,11c10.75223,4.62488 21.6391,7.15756 36,11c10.80042,2.8898 24.28275,5.17593 37,10c11.29753,4.28552 32.86905,11.46899 50,16c16.88367,4.46558 34.98621,8.09814 56,11c14.99048,2.07007 29.02432,5.50732 34,6c5.07422,0.50244 19.08395,3.55798 36,7c13.07376,2.66022 29.00659,5.81848 59,7c22.00565,0.86688 41.13611,-0.31018 57,2c13.20239,1.92261 26.76184,5.49158 41,7c13.92212,1.47491 15.01337,-0.58911 28,0c22.06805,1.00104 47,2 72,2c36,0 57,0 72,0c13,0 25,0 40,0c15,0 29,0 47,0c17,0 32,0 45,0c16,0 28.03204,0.83875 39,0c13.11462,-1.00293 24.95428,-5.13977 37,-9c12.95264,-4.15088 24.44153,-5.3042 39,-10c11.49963,-3.70917 20.30457,-7.97308 32,-12c9.31232,-3.20636 15.35394,-4.69037 25,-8c6.34509,-2.17706 11.88574,-6.32422 20,-9c6.91394,-2.27997 15.03064,-4.75519 24,-6c12.05005,-1.67236 21.2323,-2.53879 32,-5c8.32922,-1.90384 18.35144,-4.4505 26,-7c7.64856,-2.5495 13.13049,-3.48758 18,-5c7.27307,-2.25894 12.30359,-3.37256 19,-7c6.34058,-3.43469 14.13306,-7.56952 18,-9c6.2915,-2.32739 11.37207,-6.3851 15,-9c3.44177,-2.48071 7.78491,-9.22733 12,-13c4.77112,-4.27039 9.24609,-7.6235 14,-11c6.36755,-4.52261 9,-8 12,-12c3,-4 7.21289,-8.07739 10,-13c2.03149,-3.58792 5.8512,-8.48532 8,-13c3.54395,-7.4458 4.45972,-11.84235 7,-20c1.22583,-3.93668 2.14771,-8.94342 4,-14c1.08765,-2.96933 1.35925,-6.05164 2,-10c0.50659,-3.12143 1,-4 1,-9c0,-3 0,-5 0,-8c0,-4 0,-7 0,-11c0,-4 -1,-8 -2,-11c-1,-3 -2,-5 -4,-9c-1,-2 -1.38513,-4.37201 -4,-8c-2.48071,-3.4418 -7.40405,-6.41156 -12,-10c-4.45874,-3.48129 -8.1958,-5.64886 -12,-8c-4.2533,-2.62866 -9.92761,-6.23172 -16,-8c-7.91736,-2.30554 -20.83435,-5.48865 -32,-9c-14.8092,-4.65715 -25.58057,-6.98047 -40,-8.99998c-3.9613,-0.55481 -10.00977,-0.80292 -12,-1c-5.07422,-0.50244 -17.03625,-2.65959 -28,-4c-13.05579,-1.59618 -27.91602,-4.48926 -44,-7c-23.89734,-3.73041 -38.69116,-5.19386 -52,-8c-16.74896,-3.53148 -33.04547,-3.68456 -48,-6c-17.05939,-2.64134 -34.92993,-5.4286 -52,-8c-15.94464,-2.40186 -31.98059,-3.10532 -48,-6c-22.97321,-4.15121 -38.04413,-5.67409 -54,-8c-18.05743,-2.63226 -36.61444,-5.74382 -60,-10c-18.7962,-3.42091 -36,-2 -54,-2c-14,0 -29,0 -41,0c-14,0 -31,0 -43,0c-16,0 -32,0 -48,0c-14,0 -30,0 -45,0c-15,0 -28,0 -43,0c-16,0 -29,0 -49,0c-14,0 -25,0 -39,0c-14,0 -24.16684,-1.90854 -35,0c-11.52719,2.03081 -24.89774,4.48392 -38,7c-12.91693,2.48048 -28.07831,4.64464 -47,9c-16.07214,3.69946 -29.797,7.2565 -31,8c-10.75998,6.65002 -20.23531,6.36955 -29,10c-8.26343,3.42282 -13.89171,8.19576 -21,12c-7.88594,4.22043 -17.28932,7.28189 -23,10c-11.77287,5.60353 -17,11 -22,13.99998c-5,3 -9.05859,5.91895 -16,11c-4.03461,2.95331 -6.41156,7.40402 -10,12c-3.4813,4.45877 -6.41886,8.25659 -8,13c-1.26491,3.79474 -2.99245,9.81558 -4,18c-0.61092,4.96252 0,12 0,18c0,5 -0.85529,9.05246 0,16c0.50378,4.09222 3,10 5,14c2,4 3.5971,11.59677 8,20c2.32053,4.42889 7.41452,12.39722 13,20c5.45853,7.42996 10.43625,11.43967 17,17c4.3163,3.65646 9.43195,9.73459 17,15c8.45139,5.87997 18.46593,9.17944 26,14c10.78716,6.90198 24.10802,16.62408 34,21c7.54128,3.33603 17.67072,6.72147 28,11c11.68625,4.84061 23.33292,9.85693 35,13c9.70392,2.6142 22.03995,5.84445 34,9c18.06342,4.76587 34.7597,9.48389 55,12c19.87204,2.47034 41.00043,4.97064 42,5c17.02203,0.50024 38,1 58,1c16,0 33.02881,-0.44702 52,1c20.04156,1.52863 44,2 77,2c23,0 42.02484,-0.99628 62,0c20.07477,1.00122 41,2 64,2c26,0 49,0 75,0c22,0 45,0 74,0c16,0 32.04089,0.98975 44,0c12.12408,-1.00342 22.84442,-3.41327 33,-7c12.82513,-4.52954 22.75781,-8.6264 35,-13c9.83173,-3.51245 21.92657,-7.24704 35,-11c14.92151,-4.28348 27.21082,-7.45334 33,-10c9.42407,-4.14566 16.02747,-7.95468 21,-11c8.04517,-4.92706 15.52039,-10.86526 24,-15c10.52063,-5.12994 21.32996,-9.38828 31,-15c6.23694,-3.61945 13.13879,-7.81116 20,-13c5.10706,-3.8623 11.07275,-7.8819 16,-11c6.09351,-3.85614 10.68469,-6.12683 16,-11c4.71973,-4.32715 8.22729,-8.78491 12,-13c4.27039,-4.77115 6.17358,-10.29095 9,-17c3.13013,-7.42984 7.92554,-14.62061 10,-21c1.8811,-5.78461 3.49622,-10.90778 4,-15c0.48877,-3.97003 0,-8 0,-11c0,-3 0.12817,-6.08954 -2,-9c-3.77942,-5.16873 -7.75256,-9.34491 -16,-15c-7.78064,-5.33499 -17.70154,-11.58298 -29,-17c-11.72229,-5.62021 -24.547,-11.09946 -38,-16c-10.71313,-3.90247 -25.77112,-8.69653 -37,-12c-21.6438,-6.36752 -35,-8.99998 -48,-11.99998c-13,-3 -28.88623,-5.68797 -45,-8c-19.896,-2.85469 -35.948,-5.29214 -52,-8c-19.94202,-3.36406 -36.86908,-5.20528 -59,-7c-37.88879,-3.07262 -59.07953,-1.28976 -89,-5c-27.08722,-3.3589 -51.98297,-8.49988 -74,-9c-23.99384,-0.54503 -46,0 -67,0c-23,0 -44,0 -66,0c-28,0 -48,0 -65,0c-17,0 -33,0 -48,0c-15,0 -29,0 -44,0c-17,0 -36,0 -51,0c-15,0 -31,0 -59,0c-16,0 -28.11868,-1.81906 -42,0c-15.39258,2.01711 -27.11172,4.46118 -38,7c-14.17986,3.3063 -26,7 -38,11c-15,5 -27.95007,8.166 -41,12c-24.90875,7.31805 -36,9 -39,10c-12,4 -21.11329,6.83504 -27,10.99998c-8.16339,5.77573 -12.72651,10.29361 -17,14c-3.77727,3.276 -6.44298,5.6387 -8,8c-2.96449,4.49576 -4.11717,15.96872 -7,27c-1.04249,3.98914 -1,10 -1,18c0,9 0,22 0,34c0,6 -1.04952,14.47662 3,22c6.44656,11.97672 13.95464,23.95465 25,35c11.04536,11.04535 23.07971,18.19452 40,24c19.2921,6.61926 29.41354,9.8476 52,16c26.49376,7.21671 53.42203,11.35812 74,16c11.41782,2.57556 26.25049,4.8064 62,10c24.26062,3.52454 47.86682,10.94656 73,14c23.90741,2.90454 46.68677,7.96011 72,11c23.84946,2.86414 48.99597,5.09247 71,6c26.99554,1.1134 50.96881,1.49878 79,3c27.97778,1.49835 81,3 112,3c30,0 61,2 93,2c30,0 59,0 85,0c23,0 47.01923,-0.76373 73,-3c21.01733,-1.80902 49.82495,-7.55304 68,-13c14.87073,-4.45667 28.30188,-8.00333 43,-13c12.30823,-4.18423 23,-11 33,-15c10,-4 19.47363,-7.9881 31,-14c11.56042,-6.02966 19.08215,-14.92462 31,-28c9.06287,-9.94308 15.74939,-18.18668 24,-29c7.76819,-10.18112 12.36951,-20.23532 16,-29c3.42285,-8.26343 6.38782,-15.10059 8,-23c1.45581,-7.13306 3,-14 3,-22c0,-12 0.85522,-16.05246 0,-23c-0.50378,-4.09222 -4.90381,-10.06528 -9,-16c-4.88647,-7.07971 -12.89551,-13.19769 -26,-20c-15.87695,-8.24142 -33.7572,-15.68628 -64,-25.99998c-18.8584,-6.43127 -39.94763,-12.29961 -62,-16c-25.94324,-4.35327 -34.03467,-4.69447 -53,-7c-29.06061,-3.53276 -62.1908,-4.4402 -93,-9c-25.2204,-3.73265 -52,-7 -77,-11c-25,-4 -64,-5 -67,-5c-21,0 -48,0 -74,0c-25,0 -39.00537,-0.452 -58,0c-21.01782,0.50014 -47.00464,0.5195 -72,1c-26.0144,0.50009 -52.17389,2.4783 -85,7c-27.20221,3.74701 -51.24808,7.21088 -72,11c-22.43262,4.09601 -42.15302,9.39618 -63,15c-20.16479,5.42044 -42.31647,6.93077 -62,11c-22.6087,4.67397 -43.27029,10.09795 -68,17.99998c-25.30994,8.08743 -57.23163,20.19067 -76,26c-14.20134,4.39569 -26.63503,10.14236 -35,17c-7.6557,6.27618 -11.3853,13.77173 -16,22c-3.28136,5.85086 -7.48393,14.67035 -9,25c-0.29043,1.97879 -1.47644,4.63571 3,13c5.38,10.05264 17.66628,20.55493 34,30c29.4333,17.02002 61.46169,30.54022 91,40c18.71078,5.99222 80.28439,20.20682 142,39c63.34738,19.2901 156.92767,37.70807 222,44c69.93054,6.76172 138,10 204,10c60,0 110.94586,-5.34937 155,-12c41.95105,-6.33313 80.12341,-11.30154 116,-18c29.11108,-5.4353 55.52344,-15.18256 94,-30c19.77405,-7.61502 36.18579,-14.21252 49,-24c8.99109,-6.86734 13.33447,-15.89365 17,-28c3.30408,-10.91254 6.14136,-25.10272 8,-37c2.05933,-13.18179 3.98975,-23.04089 3,-35c-1.00342,-12.12408 -5.72998,-24.66519 -13,-37c-9.44482,-16.02484 -25.45923,-29.39157 -43,-39c-22.48022,-12.31418 -47.41284,-20.34769 -83,-27.99998c-40.51074,-8.71101 -83.06506,-12.48468 -93,-14c-34.31622,-5.23404 -127.91608,-18.92665 -167,-22c-72.88452,-5.73125 -147,-9 -217,-9c-64,0 -117.10217,4.33894 -158,11c-39.10791,6.36954 -68.90115,14.32889 -105,25c-27.92584,8.25511 -68.18454,20.4232 -94,28.99998c-28.21567,9.37421 -54.58238,21.38336 -79,28c-18.74062,5.07831 -33.44547,10.44797 -41,17c-7.47861,6.48618 -13.8968,18.78915 -17,34c-2.82693,13.85672 -2,29 -2,41c0,7 2.13103,21.12973 13,37c11.21594,16.37689 30.6162,31.76651 60,46c41.48671,20.0961 71.04538,31.76285 103,38c69.10193,13.48785 151.72165,30.74707 237,38c113.74713,9.67419 182.9519,4.63672 242,-3c64.94952,-8.3999 123.78973,-16.46613 185,-32c57.93799,-14.7034 93.78613,-32.69949 132,-44c28.84827,-8.53094 63.61206,-16.55756 98,-32c38.75684,-17.40436 60.62646,-29.09094 72,-42c9.76062,-11.0784 12.99597,-26.86484 14,-38c0.98792,-10.95557 0.38013,-20.19925 -5,-30c-5.61182,-10.2229 -17.78601,-23.93759 -36,-34c-22.75793,-12.57278 -56.63721,-24.23611 -99,-35.99998c-68.47229,-19.01428 -130.93896,-32.34178 -186,-42c-70.92407,-12.44073 -89.87872,-16.84952 -129,-22c-72.80878,-9.58559 -141.01593,-17.63876 -213,-21c-58.01434,-2.70894 -102,-4 -168,-4c-31,0 -55.26776,1.07205 -81,9c-23.27213,7.17 -47.74518,16.88069 -74,24c-16.85556,4.57059 -33.41501,11.17198 -48,19c-18.58707,9.97601 -33,19 -45,29c-12,10 -32.21162,21.85405 -36,30.99998c-0.38269,0.92389 -4.4201,4.70151 -10,13c-6.50722,9.67761 -10.98491,19.63113 -13,36c-1.22183,9.92508 -0.52716,27.00732 0,46c0.5002,18.02081 5.82553,35.62732 31,67c21.26053,26.49509 51.28497,52.15439 83,71c43.08698,25.60303 91.49954,44.6225 153,55c31.7995,5.36578 100.00775,5.09827 178,4c71.02112,-1.00012 136.20807,4.21759 229,-2c52.35162,-3.50787 104.64941,-11.57495 145,-21c37.87775,-8.84747 63.63184,-20.90796 85,-34c19.63025,-12.02725 36.43506,-25.95685 47,-42c9.34973,-14.19794 19.12573,-31.26068 28,-46c8.07361,-13.40955 13.2981,-27.9389 15,-37c2.42798,-12.92691 3.64795,-25.03455 5,-37c1.58789,-14.0527 4,-25 4,-36c0,-8 1.02856,-18.44388 -5,-31c-6.01294,-12.52374 -21.81921,-35.44669 -35,-44.99998c-14.86401,-10.77321 -36.70435,-19.86176 -56,-26c-25.65881,-8.16246 -56.01318,-12.91887 -87,-18c-30.013,-4.92145 -44.73645,-8.50854 -71,-10c-50.95709,-2.89374 -150.00745,1.01549 -215,2c-66.02271,1.00012 -134,2 -202,2c-65,0 -122,0 -159,0c-33,0 -60.98956,0.09895 -89,3c-19.99281,2.07066 -41.81847,1.21918 -64,8c-2.13838,0.6537 -5.0125,3.33076 -10,6c-4.49568,2.40601 -9,5 -11,7c-3,3 -5.88052,4.95782 -8,11c-1.32402,3.77452 -1.49829,10.93796 -2,17c-0.98976,11.95911 -0.45314,20.01027 0,29.99998c0.50052,11.03403 5.93277,27.02783 13,44c7.92474,19.03152 18.19173,35.03098 31,52c12.19868,16.16144 27.91243,37.87503 45,58c16.02486,18.87335 43.19461,51.11627 65,66c22.23904,15.17975 44.01291,23.83981 45,24c12.48578,2.02618 23,8 25,8c1,0 6.09665,-1.38702 16,0c14.41949,2.01953 25.93741,6.38171 37,8c8.96002,1.31073 14,2 19,2c5,0 12,0 18,0c4,0 11.10361,-0.91907 24,1c9.11914,1.35699 17.96262,3.49939 28,4c7.99005,0.3985 17,0 24,0c4,0 8,1 11,1c1,0 3,0 4,0c2,0 6.00867,-0.41559 16,0c12.03119,0.50043 27,2 39,2c14,0 22,0 27,0c7,0 11,0 18,0c6,0 13,-1 24,-1c11,0 23,0 35,0c11,0 25,0 33,0c8,0 15.9585,-0.49921 25,-1c7.98773,-0.44238 17.94672,-2.49872 25,-3c4.98743,-0.35443 10,0 15,0c3,0 4,-1 8,-1c4,0 5,0 8,0l2,0l1,0l0,1" id="svg_1" opacity="undefined" stroke="#000" stroke-width="0.9" fill="none" class="path1" data-scroll/>
</g>
</svg>
LocomotiveScroll cant see the SVG, so you just know when you see the svg by embedding between HTML tag..but no solution inside SVG a fortiori in path
I need a help to plot a spectra with plt.steps function in matplotlib. As the data is noisy, in gnuplot I used smooth bezier option to smoothen. Is there any similar option in matplotlib? spline is not able to smoothen the data in desired level. Here is a sample data set https://drive.google.com/open?id=0B4shfFfM7MOqV2h3ZDA0RXlOa2M
I have plotted by plt.steps(data[:,0],data[:,1]) with log x value.
Plot is attached.matplotlib image
. how to smoothen the entire data with matplotlib.(I am quite new to python plotting)
A trivial low-pass filter seems effective. Tune alpha as desired.
#! /usr/bin/env python3
import matplotlib.pyplot as plt
def smooth(y, alpha=0.1):
ret = []
sm = y[0] # smoothed value, a moving average
for val in y:
ret.append(sm)
sm = alpha * val + (1 - alpha) * sm
return ret
def plot(points):
x = [a for a, b in points]
y = [b for a, b in points]
plt.subplot(211)
plt.semilogx(x, y)
plt.subplot(212)
plt.semilogx(x, smooth(y))
plt.savefig('/tmp/smoothed.png')
if __name__ == '__main__':
plot([
(0.25, 0.000),
(0.35, 0.055),
(0.45, 0.103),
(0.55, 0.104),
(0.65, 0.143),
(0.75, 0.140),
(0.85, 0.143),
(0.95, 0.143),
(1.05, 0.126),
(1.15, 0.223),
(1.25, 0.217),
(1.35, 0.232),
(1.45, 0.225),
(1.55, 0.219),
(1.65, 0.223),
(1.75, 0.236),
(1.85, 0.216),
(1.95, 0.222),
(2.05, 0.244),
(2.15, 0.244),
(2.25, 0.257),
(2.35, 0.221),
(2.45, 0.221),
(2.55, 0.213),
(2.65, 0.238),
(2.75, 0.209),
(2.85, 0.223),
(2.95, 0.226),
(3.05, 0.212),
(3.15, 0.247),
(3.25, 0.247),
(3.35, 0.236),
(3.45, 0.215),
(3.55, 0.218),
(3.65, 0.241),
(3.75, 0.209),
(3.85, 0.239),
(3.95, 0.221),
(4.05, 0.169),
(4.15, 0.246),
(4.25, 0.230),
(4.35, 0.229),
(4.45, 0.242),
(4.55, 0.264),
(4.65, 0.188),
(4.75, 0.182),
(4.85, 0.248),
(4.95, 0.172),
(5.05, 0.189),
(5.15, 0.228),
(5.25, 0.183),
(5.35, 0.272),
(5.45, 0.201),
(5.55, 0.204),
(5.65, 0.203),
(5.75, 0.198),
(5.85, 0.187),
(5.95, 0.244),
(6.05, 0.229),
(6.15, 0.202),
(6.25, 0.234),
(6.35, 0.231),
(6.45, 0.173),
(6.55, 0.206),
(6.65, 0.173),
(6.75, 0.178),
(6.85, 0.183),
(6.95, 0.188),
(7.05, 0.181),
(7.15, 0.153),
(7.25, 0.150),
(7.35, 0.183),
(7.45, 0.188),
(7.55, 0.111),
(7.65, 0.145),
(7.75, 0.195),
(7.85, 0.192),
(7.95, 0.156),
(8.05, 0.126),
(8.15, 0.095),
(8.25, 0.151),
(8.35, 0.127),
(8.45, 0.130),
(8.55, 0.095),
(8.65, 0.127),
(8.75, 0.219),
(8.85, 0.122),
(8.95, 0.094),
(9.05, 0.128),
(9.15, 0.054),
(9.25, 0.122),
(9.35, 0.080),
(9.45, 0.139),
(9.55, 0.107),
(9.65, 0.097),
(9.75, 0.087),
(9.85, 0.050),
(9.95, 0.090),
(10.05, 0.053),
(10.15, 0.121),
(10.25, 0.055),
(10.35, 0.056),
(10.45, 0.014),
(10.55, 0.087),
(10.65, 0.044),
(10.75, 0.150),
(10.85, 0.077),
(10.95, 0.140),
(11.05, 0.064),
(11.15, 0.065),
(11.25, 0.132),
(11.35, 0.050),
(11.45, 0.068),
(11.55, 0.017),
(11.65, 0.000),
(11.75, 0.072),
(11.85, 0.110),
(11.95, 0.056),
(12.05, 0.057),
(12.15, 0.115),
(12.25, 0.098),
(12.35, 0.060),
(12.45, 0.101),
(12.55, 0.041),
(12.65, 0.062),
(12.75, 0.063),
(12.85, 0.064),
(12.95, 0.065),
(13.05, 0.066),
(13.15, 0.157),
(13.25, 0.023),
(13.35, 0.093),
(13.45, 0.094),
(13.55, 0.072),
(13.65, 0.048),
(13.75, 0.098),
(13.85, 0.125),
(13.95, 0.101),
(14.05, 0.051),
(14.15, 0.104),
(14.25, 0.053),
(14.35, 0.054),
(14.45, 0.054),
(14.55, 0.083),
(14.65, 0.112),
(14.75, 0.113),
(14.85, 0.115),
(14.95, 0.087),
(15.05, 0.029),
(15.15, 0.000),
(15.25, 0.091),
(15.35, 0.031),
(15.45, 0.124),
(15.55, 0.031),
(15.65, 0.032),
(15.75, 0.065),
(15.85, 0.033),
(15.95, 0.033),
(16.05, 0.000),
(16.15, 0.068),
(16.25, 0.000),
(16.35, 0.070),
(16.45, 0.141),
(16.55, 0.143),
(16.65, 0.072),
(16.75, 0.073),
(16.85, 0.000),
(16.95, 0.037),
(17.05, 0.113),
(17.15, 0.077),
(17.25, 0.039),
(17.35, 0.078),
(17.45, 0.079),
(17.55, 0.040),
(17.65, 0.041),
(17.75, 0.082),
(17.85, 0.041),
(17.95, 0.042),
(18.05, 0.042),
(18.15, 0.043),
(18.25, 0.043),
(18.35, 0.000),
(18.45, 0.133),
(18.55, 0.134),
(18.65, 0.045),
(18.75, 0.091),
(18.85, 0.046),
(18.95, 0.093),
(19.05, 0.236),
(19.15, 0.048),
(19.25, 0.145),
(19.35, 0.049),
(19.45, 0.000),
(19.55, 0.050),
(19.65, 0.000),
(19.75, 0.101),
(19.85, 0.205),
(19.95, 0.155),
(20.05, 0.052),
(20.250, 0.034),
(21.750, 0.029),
(23.250, 0.036),
(24.750, 0.033),
(26.250, 0.048),
(27.750, 0.051),
(29.250, 0.033),
(30.750, 0.033),
(32.250, 0.089),
(33.750, 0.084),
(35.250, 0.068),
(36.750, 0.089),
(38.250, 0.017),
(39.750, 0.049),
(41.250, 0.093),
(42.750, 0.043),
(44.250, 0.069),
(45.750, 0.049),
(47.250, 0.096),
(48.750, 0.065),
(50.250, 0.098),
(51.750, 0.042),
(53.250, 0.088),
(54.750, 0.105),
(56.250, 0.074),
(57.750, 0.065),
(59.250, 0.096),
(60.750, 0.129),
(62.250, 0.075),
(63.750, 0.142),
(65.250, 0.116),
(66.750, 0.035),
(68.250, 0.091),
(69.750, 0.170),
(71.250, 0.119),
(72.750, 0.082),
(74.250, 0.086),
(75.750, 0.223),
(77.250, 0.163),
(78.750, 0.097),
(80.250, 0.175),
(81.750, 0.182),
(83.250, 0.108),
(84.750, 0.196),
(86.250, 0.145),
(87.750, 0.090),
(89.250, 0.372),
(90.750, 0.224),
(92.250, 0.132),
(93.750, 0.171),
(95.250, 0.141),
(96.750, 0.146),
(98.250, 0.225),
(99.750, 0.503),
(101.250, 0.199),
(102.750, 0.123),
(104.250, 0.169),
(105.750, 0.174),
(107.250, 0.224),
(108.750, 0.368),
(110.250, 0.284),
(111.750, 0.243),
(113.250, 0.150),
(114.750, 0.256),
(116.250, 0.263),
(117.750, 0.540),
(119.250, 0.332),
(120.750, 0.567),
(122.250, 0.407),
(123.750, 0.477),
(125.250, 0.122),
(126.750, 0.313),
(128.250, 0.384),
(129.750, 0.328),
(131.250, 0.335),
(132.750, 0.411),
(134.250, 0.351),
(135.750, 0.574),
(137.250, 0.367),
(138.750, 0.150),
(140.250, 0.536),
(141.750, 0.391),
(143.250, 0.479),
(144.750, 0.489),
(146.250, 0.333),
(147.750, 0.510),
(149.250, 0.520),
(150.750, 0.796),
(152.250, 0.090),
(153.750, 0.092),
(155.250, 0.563),
(156.750, 0.478),
(158.250, 0.487),
(159.750, 0.298),
(161.250, 0.405),
(162.750, 0.206),
(164.250, 0.735),
(165.750, 0.428),
(167.250, 0.653),
(168.750, 0.332),
(170.250, 0.113),
(171.750, 0.459),
(173.250, 0.117),
])