plot with hist function get wrong normalized probability density figure - python-3.x

I want drow a simple hist plot, with density=True, the data saved in the data.txt file, I put here:
-3.159589616094560238e-02
-2.238517986981702901e-02
3.685513259832978727e-02
5.551115123125782702e-17
3.855829197377269590e-02
1.106747485805819609e-01
-1.343976685751569478e-01
4.594910529316376113e-03
4.908490856818659154e-04
3.419692699076753994e-02
-1.000969353410680052e-02
-3.022899285774027778e-02
-5.537409517542163373e-02
-4.602923607484266100e-02
3.284859133476397686e-02
-1.023686626680164746e-02
-3.664415656649880337e-02
8.171815787883440763e-02
2.999203027116759124e-02
5.004522795043858663e-02
7.388383006436807787e-02
6.113278573286806683e-02
6.386857025829173473e-02
3.591723008598152189e-02
6.549840356253561202e-02
1.253856364955455160e-02
6.041119437265624059e-02
6.908608718235104140e-02
1.134341604638248180e-01
-1.576914025344122727e-02
-2.417229901971842954e-02
-3.899153022868465102e-02
4.689096941761000670e-02
5.841198683607556896e-02
8.641413395100966399e-02
5.642541143884205468e-02
4.930903227540417433e-03
1.942745077277890919e-02
2.158310326121676281e-02
1.049712334090066590e-02
1.754053058915017171e-02
-2.353744351610204122e-02
-8.208313574505410326e-03
5.744397964275682611e-02
-1.211723809639734806e-01
-8.992113883794172757e-02
1.061556222415527273e-02
-2.920395846191836675e-02
1.037069716181004964e-03
-3.161371576086063895e-02
-3.612043404641407385e-02
-1.809334659086286878e-02
3.662870373600723983e-02
1.391056336430290807e-02
-1.172024701805174929e-01
3.251886867868275521e-02
2.396867235334465551e-02
3.837332827102124533e-02
6.056630689588365923e-02
8.321671975043376523e-02
1.115621200150082593e-01
8.420054612809740879e-02
5.823374107493473062e-02
7.729794103241893755e-02
2.477495629227444152e-02
2.972088991663957014e-02
3.742060783581174777e-02
-1.110223024625156540e-16
2.587337514429000063e-02
1.527836714091357351e-02
1.958896955617406288e-02
-1.832210450473931163e-02
-1.926657560263266011e-02
2.339325805152586701e-02
-6.324903516012525539e-02
-6.690299051450193657e-02
-2.482072685296415893e-02
3.064499196744452370e-02
3.355998562941886476e-02
1.788746275401903452e-02
4.613919286422546451e-03
-8.927918985562194321e-03
1.028462556431128383e-02
5.532095657291985491e-02
6.604320581321337924e-02
3.669973111374175145e-02
2.277477855616832914e-02
4.808227903197481723e-02
4.832747444828244809e-02
7.656143177495855490e-03
1.245515608493746873e-02
2.349500690106676171e-02
4.072972204376856808e-03
2.516504860752621919e-02
2.003738740895273651e-02
-2.613223707890222069e-02
4.011136596889314232e-03
2.548231927644559192e-02
1.330938824527588826e-02
2.404439993147697296e-02
6.907130907663830421e-03
6.979484635157226502e-03
-3.290848338052448918e-02
-1.755191743006401239e-02
-3.366674089662069491e-04
5.945578987875954624e-05
-1.632427050508156174e-02
-8.658771138098070308e-02
-4.820886804917889901e-02
-8.546677486103770871e-03
-6.925724668856880761e-03
-9.925127350824403116e-04
-2.449622387186950467e-02
3.123051142945909575e-02
5.795788098893345230e-02
3.605543122998344785e-02
3.302943330800275912e-02
7.059531249141720588e-02
5.853930993753908574e-02
3.905874422983779404e-02
4.843263815672965711e-02
4.147627035435175191e-02
8.400424535113787394e-02
9.844201764532001242e-02
9.294548499676424935e-02
6.497483032833101246e-02
1.144645348202695256e-01
2.999608390738961461e-02
3.085053739416804275e-02
2.276726259836320265e-02
0.000000000000000000e+00
-2.510456168410146738e-02
2.116637291906409146e-02
-3.321700185738685196e-02
3.982853772878908183e-03
1.363191485535983349e-02
1.564968650026804520e-02
1.478997225428510531e-02
-3.131685025064945282e-03
-3.806954212751323396e-02
-8.159214863622976655e-03
-7.186257889362090978e-02
-9.500427775385178464e-04
-3.395150378118699797e-02
7.110268582201983989e-03
-2.162228010763439512e-02
-5.384418762160989025e-02
-7.415379224082696563e-03
8.122245670091066128e-03
-2.878373343427720332e-02
-4.544898403509023410e-04
2.231065952279343012e-02
5.253618584763958266e-02
7.567731789121345809e-03
1.043630861213364069e-02
9.691633727966997292e-03
-2.829666135637745605e-03
-1.504340107365054191e-03
1.140727886561562765e-02
1.089115013359434614e-02
1.044992233561446715e-02
9.693261114407991652e-03
-5.238694978638769317e-02
-2.457125444725005714e-02
1.077886426445628931e-03
-4.871118148953068605e-02
-6.495809610443054050e-02
-3.267035029465242824e-02
-2.674999216286094716e-02
-3.357327749680671936e-02
-8.093857036171048236e-03
4.214960036162579415e-02
8.643719482737677318e-03
-5.065308732882500831e-02
-1.275187831141166850e-02
4.968104321639105203e-03
3.038550497837352871e-02
1.292634450475451113e-01
9.960248360301909853e-02
9.926289065772253561e-02
1.218752249462111137e-01
6.588591178993197239e-02
5.093094629578931443e-02
4.116752669646578378e-02
4.345115715519703992e-02
1.576461619520656832e-02
4.396757184635238791e-03
-4.521077126215883313e-03
1.461648603205449592e-02
4.788312032257657780e-02
2.755872630307917848e-02
6.861615560310868611e-03
2.549852881708733476e-02
-5.168013319340802880e-03
-1.887369212351849845e-02
-2.441207169456885429e-02
-3.320040226240705827e-02
-6.425229768996637558e-02
-3.663909065452941594e-02
-3.102327088584733161e-02
-4.127076305809684875e-02
-5.684992379213882341e-03
2.906307859990353570e-03
-3.900653434877507375e-02
1.512074322144520977e-01
-2.515933869270309264e-02
-6.296389906200300368e-02
-9.272701261054544508e-02
-4.790753677805792421e-03
4.813151476583615862e-02
7.650062035746391098e-02
3.302890273769037988e-04
5.380904266441388639e-03
-2.202552482575392823e-03
-2.787433399598707173e-04
3.384160594702279035e-02
1.300796256094960412e-02
-1.160214859858521574e-02
-6.277244073332632901e-02
-1.903552999494984022e-02
1.025375794049160350e-02
-1.097075016073090215e-03
-5.379827426551375691e-02
-2.094588005309211409e-02
-2.364953944195369306e-02
-2.383070948888221796e-02
-1.750399960104281893e-02
1.497421083089922611e-02
2.725070332141532603e-02
7.403530041943423567e-02
3.001483011466621331e-02
4.337594882232209681e-02
6.706027060741315271e-02
7.233079294473854226e-02
1.292045961433705981e-01
1.877234340958466863e-02
6.212823063689587588e-02
8.667098195715983167e-02
7.350219246286576746e-02
3.159743487146293717e-02
5.139887107014962098e-02
1.935309979350974263e-02
-3.410445703281306251e-04
9.794976840847402499e-03
-6.959086538445014014e-03
1.201927489478310518e-02
1.439413096064678932e-02
-4.486192051086429489e-02
-1.529194554502161241e-02
-3.072446651081427171e-02
-3.430002826759373513e-02
1.718162677056368770e-02
3.225957229830100914e-03
-1.497698355531706937e-02
-1.331288468251978774e-02
1.659058944413624448e-02
2.663588063070934653e-02
-5.922524084111119302e-03
5.636060111551793872e-03
-2.049342974060008871e-02
-3.803998428758581518e-02
1.830300118925570763e-03
3.424729726582459444e-02
-2.895366428311385576e-02
-3.386403989355701860e-02
-7.079295637878763037e-02
-7.093079263306317772e-02
3.198451446435424117e-02
9.545864656146652028e-02
-7.516704766287746198e-02
-8.108517870498599400e-02
-1.177430403484454047e-01
-3.120935658466644780e-02
9.223154995107774035e-02
-1.941212424528665492e-02
3.411902669265831634e-03
-2.354139203324806529e-03
-3.071645493442498598e-02
-4.164925521383888718e-02
-3.122691837708191365e-02
2.883660684356703641e-02
-5.717969520583865428e-02
-6.697810496817224735e-03
9.441536785215753902e-03
4.728317922800373552e-03
2.049464471048090264e-03
5.739566329777823217e-02
7.567444227145320168e-02
5.682425425263715191e-02
2.127495371418597347e-02
5.243610080135335805e-02
6.029907063806672074e-02
6.969759432272237820e-02
5.641399207835956497e-02
7.288261681999158581e-02
5.756469121404828027e-02
7.178193358914231048e-02
5.381813355449260872e-02
9.644985199153865985e-02
6.435194910225061626e-02
1.117112490506719791e-01
2.439163554038270565e-02
2.557084230623229981e-03
2.469910898473459682e-02
-9.569424158990702534e-03
-5.173909847879420987e-02
-2.771943460190381958e-02
-7.918742305681764071e-03
-3.247312870800173057e-02
-3.910586948488503634e-03
-3.242901716659532529e-02
6.020118668182583566e-03
1.858335310757686099e-02
1.685456044577338108e-02
-3.478529517587825026e-02
-5.549822951020677575e-02
1.016235026400252872e-02
2.200445534907724543e-02
3.048728364537484081e-02
3.272163712735043362e-02
2.395435266492118576e-02
2.480370438536083633e-02
1.056266120762306415e-01
-1.082460774310889384e-01
-1.347452419485566932e-01
-7.714839854654403917e-02
-1.900100074423183294e-02
-2.368723808155448474e-03
0.000000000000000000e+00
-2.355757032900079873e-02
9.196526397255683216e-03
-1.249529199393473178e-03
-3.236878688899802459e-02
-3.136013706852952554e-02
-5.156107379348240372e-04
-1.377622880706341757e-01
-2.396047220463182192e-02
-9.684884856711595269e-02
-1.842852002418049473e-02
-3.176145780247169315e-02
-4.241533961730808988e-02
-2.973026167434550393e-02
-1.646074567045308079e-02
6.668870098842760719e-03
5.033457963755305631e-02
2.969935511689753005e-02
5.231368543525652393e-02
5.162632846998616021e-02
7.889039094445621236e-02
8.296260101450758651e-02
9.697524611355656798e-02
8.633834112993971077e-02
1.005506084517912013e-01
1.164298262869764011e-01
1.025027965383787376e-01
1.135352705294886966e-01
1.008843418671770964e-01
1.088638311190759378e-01
2.884552324651995514e-02
3.991830833263365630e-02
4.760570909695638342e-02
1.693027396115567851e-02
3.933182809711910366e-02
-6.408816681512249924e-02
-5.529609835923893213e-02
-2.993717135309542643e-02
-8.085331618384095087e-03
-6.185204488784304400e-02
-1.196921502674397897e-01
-4.780768033549070983e-02
-1.274389715508722487e-02
-1.280925978066266291e-02
-4.849996655662441869e-02
-3.646866106294993637e-02
-2.756873004038262742e-02
-5.356826427281805025e-02
-6.242776544651362780e-02
-6.124211990236372305e-02
-5.686055405028850318e-02
-2.817431694836830536e-02
1.500375567808898136e-02
-6.187659459197802914e-02
-5.409826477572732273e-02
2.261388915804851685e-02
6.426257712815597323e-02
1.157463639073508244e-02
5.004890564395303443e-02
-3.950616854542954304e-03
-6.239557142348028940e-02
-8.200269713949936978e-03
-1.251492744667737078e-03
-1.265801790937595150e-01
-1.768421559080157746e-02
2.027397358647520242e-02
4.478253635871065619e-03
1.878158237154076149e-02
6.594154561536602621e-02
7.452069498742991405e-02
7.496480550402284670e-02
9.538428783854202564e-02
1.038856363174851527e-01
1.424821557236105596e-01
1.308412610257474462e-01
1.168959152275381719e-01
7.850467133577615497e-02
7.777115662308897726e-02
5.981982514235850701e-02
8.319277680590930757e-02
5.805864235677821172e-02
3.503989261654183451e-02
6.941485649918266443e-02
3.136830512895127931e-02
2.623864649120127845e-02
-1.226727174267633336e-02
1.110223024625156540e-16
-7.376709615168980383e-03
-9.038478471914745960e-03
6.986774001545778545e-03
-3.856365183713572620e-03
-8.619184960484249647e-03
-3.262580246123072958e-02
-4.651261401455147881e-02
-3.236697476015598651e-02
-1.641180100241046436e-02
-6.535594391774748879e-02
-1.126080952657532719e-01
-1.189511381184812644e-01
-5.890481919610351946e-02
-5.552142369774434871e-02
-6.347500718128468167e-02
-7.750984210293726528e-02
-4.330385478438258939e-02
-7.595236886221326533e-02
-1.040841842177327170e-01
-7.866565189792984469e-02
-9.107533039278314924e-02
-9.729503258398433663e-02
-5.155961606225628602e-02
5.716840813781481900e-02
-1.467829770886464047e-02
3.556038290053020745e-03
2.142707048989228591e-02
-3.531625991868403425e-03
4.356573820064091329e-02
-5.679040673184049259e-02
-1.487776052507348845e-02
-8.124221123796410149e-02
-5.060338391158325511e-03
-8.053437474883629044e-03
-1.801016783423853296e-02
-1.279701804251587305e-02
-1.642983927022667601e-02
-1.281404297380123181e-02
-3.444779062880543030e-03
1.814529853593149777e-02
3.516420765789823877e-02
2.194975082694949897e-02
2.529998463330923597e-02
4.464264850721472166e-02
7.643078317437868030e-02
7.041322144265371730e-02
8.296155058167570262e-02
6.615983653818824362e-02
4.794770816378934875e-02
8.856734114244479983e-02
1.258800873696094280e-01
1.389593385184824115e-01
1.498281355904477197e-01
1.224574555233136630e-01
5.483186431966596830e-02
5.535402888271356847e-02
5.142137446889100127e-02
7.029411589955203432e-02
5.593633317006369010e-02
4.714150671382522084e-02
1.297478763856257933e-02
4.059793489800239685e-02
-3.198355232442939844e-03
-1.578471874227083127e-02
4.172631884570843219e-04
-5.481128123112230521e-03
3.958899824310690985e-03
4.854634907375310338e-02
4.584641828536167862e-02
1.283691456912186557e-02
2.086772456778712703e-04
-3.883286527456911164e-03
-6.978568771350529554e-03
-8.249607438330544551e-03
-1.821024504781104669e-02
-6.823049190367941330e-02
-2.846369680876015273e-02
-4.060232727333634717e-03
-9.065014927890668872e-02
-8.837841688435754683e-02
-1.078654283198097197e-01
-3.953937130379669984e-02
-2.733287728915720360e-02
-8.152640242757383526e-02
-1.308357512176841209e-01
-8.044444184031515621e-02
-6.068031562392728340e-02
1.875986720832878429e-02
-5.897929249547850805e-02
7.073991497246079341e-03
-6.090570638678616255e-02
-5.462943813919063363e-02
-3.270271938640623155e-02
-3.791898647128666422e-02
1.684196769300894125e-02
5.299040124461584789e-02
1.727334198115798580e-02
-3.262538445267304521e-02
-6.460900206302327975e-03
-4.187876007718888127e-03
2.104051828145839242e-03
-6.456440906927712886e-02
-8.241220464780019128e-02
-1.584243463877277325e-02
-4.451124106025378113e-02
6.204589027608536922e-02
-5.111202513504803369e-02
-3.414571659963860917e-02
-5.465147093469502337e-02
-4.490135130341305070e-02
3.297457022298994067e-02
1.138019688518973616e-01
4.166481086785100985e-02
2.925682593430106726e-02
8.335791832102096288e-02
1.134549440008136845e-01
5.318986808574899250e-02
6.326665121558505689e-02
2.901205218965235977e-02
2.709286653167519709e-02
6.061274790290466230e-02
1.854683369224696676e-02
2.902103450321780187e-02
-1.466493757378331542e-02
-8.450799006366985222e-03
3.238752353295620834e-02
6.883611128938593726e-03
6.304336365859447566e-03
2.662321664874278682e-02
2.746320655555406498e-02
3.603443934644601221e-02
2.116640782743439697e-02
5.846297720502810491e-03
6.489046663897499179e-02
-2.212720929445577411e-03
-2.189626238306757733e-02
1.809448480885464394e-02
-4.258279898892736171e-02
1.815539971975982381e-02
-6.637756744883388516e-02
-1.195477794535662885e-01
-7.761629593318347675e-02
-6.528221527559652237e-02
-7.510948509456635835e-02
-3.241960469112911691e-02
-5.811779465876976136e-02
-7.162919591932115360e-02
-1.017479140369489388e-01
-6.804471305478898557e-02
-3.655182112120397564e-02
-3.468655899873923643e-02
-7.787662238841774887e-02
-6.998641259933852110e-02
-4.354185850015890313e-02
-5.011636796222052048e-02
-3.801528925170127859e-02
1.260090902987887063e-02
4.423447876462893724e-02
1.283787124659774292e-02
4.949812209368315008e-02
-7.727269529949953863e-03
9.282469058985345911e-03
-1.151166856591892551e-02
-5.171058003512418733e-03
-1.198847871951366773e-02
-1.294468509956125946e-03
2.798713296447363774e-02
3.586060178983307978e-02
-7.076132206619289988e-04
-9.774184452153625302e-02
-1.060006385825577602e-01
-6.756566877045661057e-02
-1.298748714533518867e-01
-1.005912904186360146e-01
-9.437547579407315479e-02
-5.801209316061123333e-02
-4.550554546462615146e-02
-2.970686610155373608e-02
2.036190620496108883e-02
-6.334074918455723235e-03
1.300144335549104913e-01
8.996752652747164181e-02
-3.443754124748399370e-03
2.744909628221592346e-02
8.856880872205730171e-02
3.401716662605136499e-02
9.291635086396965448e-03
2.668220571054702450e-02
3.144660703649948541e-02
4.554336909825346114e-02
7.471406035640879018e-03
4.177724765576401600e-03
2.949815659979121429e-03
7.726256994904215358e-03
-1.183780950302602830e-02
-8.331527641184180433e-03
-6.449427336969112967e-03
-2.357439184548476563e-03
1.572601140811527576e-02
5.618800754135233610e-03
-4.734364951055336501e-03
-4.310085917632522357e-02
-1.000801848423465978e-02
-7.031537055423214833e-02
-9.082154353565163873e-02
-7.165060423128888356e-02
-4.435286882606784276e-02
-5.449526586614975021e-02
-5.823660056605653446e-02
-1.177647112629865989e-01
-1.460010232247108408e-01
-9.955322836098917660e-02
-1.104748314340267545e-01
-7.259346385162268600e-02
-1.106944801930266620e-02
-3.681924821616411325e-02
-9.659448510554280443e-03
-1.843394276381193908e-02
3.517119076792252219e-03
3.530318740158017166e-02
-2.448237276752554537e-02
-8.324086961505566817e-02
-5.846226565018575183e-02
-4.413306998637939182e-02
-3.028123726983295017e-02
-1.749517293355967729e-02
-4.239388057717285996e-02
-7.463936401822154898e-02
-7.610312681716457917e-02
-3.400887292327570144e-02
1.279300671485920637e-01
-8.000494443979655479e-03
6.057720685599143895e-02
2.338262587606632081e-02
3.357008922451221178e-02
4.446097061532966466e-02
4.985567466467188957e-02
-3.729651991065656425e-02
-1.123452980897715614e-02
-1.290967152574694354e-02
-1.169785420119778818e-03
4.339304671458821261e-03
7.960208457236550572e-03
1.612425145210272248e-02
-1.357566069003079967e-02
-1.897636113688777604e-02
-2.127467682317307762e-02
5.688677706903066955e-02
1.167397147122162249e-03
-5.238090444095563902e-02
-8.033229756483753481e-02
-5.638668031346266707e-02
-8.770126909852105079e-02
-1.139703122313763251e-01
-1.091441073080444135e-01
-9.308666913218882621e-02
-1.318168247245212754e-01
2.785215405331337157e-02
-1.706111939405730027e-03
-1.044319809233721918e-01
-1.517829994094719304e-01
-1.054769050331120228e-01
1.423877469064789847e-01
1.153685494681763735e-02
-8.706359502361496472e-03
1.135425261481345927e-03
1.441192789427614418e-03
-1.482166852378000166e-02
-2.741693694998395547e-02
3.842834910067111087e-02
-3.016686231083920422e-03
-6.272337600095162502e-02
-2.945125575841017751e-02
-8.265012146342437527e-02
-6.854100855556741201e-02
-5.195084362038110415e-02
-7.411749468435571697e-02
-2.486286453376224115e-02
-6.187847656496281434e-02
-2.968894745884106956e-02
1.762643206525443818e-02
1.294560182734616482e-02
4.221917108300238253e-02
9.920310650409752684e-02
8.521827899351425151e-02
9.774522370312288544e-03
7.499195679634462763e-02
2.732722326513375988e-02
6.350451310634608326e-02
6.490460864797181761e-02
5.707981988600985268e-02
1.844500040724739165e-02
1.417147248904337964e-02
7.990194193126673450e-03
1.009520255724344340e-02
3.898843403253271500e-02
-1.155609759566522676e-02
-2.519440484900131727e-03
2.253313653278327111e-03
5.827885242445790537e-03
9.190962784846823386e-03
1.160732911085857189e-03
-5.275909555766289394e-03
3.381787516318887632e-02
-2.721033970278663450e-02
-5.244285970630779836e-02
4.875759422490227868e-02
4.600835429833582957e-03
-3.087228383610574056e-02
8.917388299658379758e-03
-3.113625653331408838e-02
-1.478572370454844798e-02
4.940881828154741751e-02
-2.336867791265717642e-02
-5.379793719052139434e-02
-4.291909741123584032e-02
-7.477199403031892233e-02
-7.442517841205104068e-02
-1.248234745779867039e-01
-1.379519428221240851e-01
-1.371746383883072351e-01
-1.410640080491438464e-01
-7.153402382767853895e-02
-7.951004471596795353e-02
-1.459334568545657129e-01
-6.895284700299986191e-03
2.746149785201490445e-03
2.308385727351258687e-03
-7.994019877111374628e-02
-5.890325063153001306e-02
-8.784983164698587088e-02
-6.129444879220657949e-02
-6.467969716770757826e-02
-5.258220008153868807e-02
-3.986417666108588165e-02
-6.480401394489507250e-02
-7.151191855893396232e-02
1.055472282177393750e-01
5.440200566045894082e-02
3.656338981196360916e-02
6.555135724368527095e-02
8.778637220420631992e-02
7.209217548046492618e-02
4.669587885186798903e-02
5.361773176019690723e-02
2.100601311910893498e-02
6.322721469066044930e-02
6.324133263799930349e-02
2.644507624189262884e-02
6.493048045675509083e-02
4.137328830399938928e-02
-1.590679399124483862e-02
1.906620985511198185e-03
1.176733236402961735e-02
-2.724327187162875474e-02
-1.694316454009803241e-03
7.151084022793061101e-03
-2.518011196291669584e-02
-6.830186397384752084e-03
3.839225472878626810e-04
-6.383522099629515556e-03
3.213803800869874383e-02
6.646280411769012186e-03
3.469305590503041214e-03
3.161514171528406747e-03
3.286238069597990918e-03
1.312624149812902097e-02
1.332620754499003191e-02
2.640736755382855350e-02
3.996890614732073743e-02
-2.128863487235810315e-02
-7.933393845336322858e-02
-3.302483636109176945e-02
-1.015654416187094511e-01
-1.325651062865587093e-01
-1.160991618245051926e-01
-1.064432056694104567e-01
-1.184449020589762869e-01
-6.400724828316428638e-02
-1.016812531739407222e-01
-7.798906219928736228e-02
-8.767094074204545562e-02
-8.131929970818713160e-03
-4.266889541076873682e-03
-8.051025079016255193e-02
-8.142489159399107779e-02
-6.463343952452976771e-02
-3.477208304841689079e-02
-6.169485922106210385e-02
-7.794801571513843008e-02
-5.875547413448400924e-02
-2.948747628264225540e-02
-2.468786350077079028e-02
6.316931852297980043e-03
1.675770593459768865e-02
8.440158329731495268e-03
3.407307521354102642e-02
4.046558954161111332e-02
5.333240427857222077e-02
9.984317230508371610e-02
6.380628672903065901e-02
6.821895425172957994e-02
7.726852029029263047e-02
1.099879223841040976e-01
1.154725109215001821e-01
1.289915848947860155e-01
1.168403187068005611e-01
7.601204755920465406e-02
5.760226131262197180e-02
6.111537335727673659e-02
4.615846941988716035e-02
5.338692740816225468e-02
5.555730080338849852e-02
9.043577779408418227e-02
7.540903584304714524e-02
7.434934358590894465e-02
-4.715512399759397288e-02
7.006223732701544193e-03
3.364841554370112675e-03
1.690409671780922218e-02
1.103833164924136745e-02
1.126494343287030159e-02
4.057932819030787841e-03
1.368619273598631336e-03
4.626015404370703576e-02
2.132559203921788327e-03
-1.265471233206300061e-02
-4.516990638789936119e-03
-7.155526544551302215e-03
-1.352277613288392633e-02
2.621463144352664809e-02
1.939461416689092221e-02
6.185211299288173592e-03
8.045623312930225146e-03
4.407589536537970254e-03
1.191666034032462518e-02
6.547637500250988452e-03
6.270007122786691589e-03
2.630044414796584018e-03
5.806308029044277008e-03
8.511179399315754734e-04
-2.362464244201878394e-02
-3.380972184650721246e-03
6.357541814028117022e-03
1.537197145284752153e-02
6.342725900758727775e-02
7.259079807480606217e-02
1.157786344750846297e-01
7.184128864328309660e-02
-1.035335901320000307e-02
4.168878403254561160e-02
6.321671510862214571e-02
6.721673864842980795e-02
-8.634059593854637171e-02
-6.710734873617735241e-02
-5.401885723027677333e-02
-9.033267165973468682e-02
6.077874509055947172e-03
-3.288646725657162762e-02
-6.980608224949735874e-02
-9.304199209365759948e-02
4.102947654724820037e-02
1.304906824207752170e-02
3.284161330384344213e-02
-1.083123574638507891e-01
-3.474140936233205412e-02
-3.115680830226313924e-02
-8.954540738243413345e-02
-4.195714073667794475e-02
-8.509552666629494055e-02
-9.544602778678318300e-02
-7.612007930937042532e-02
-5.777839588658773007e-02
-5.979117785777282590e-02
-9.303876566862379072e-04
-1.835442822550326092e-03
5.093692506767105721e-02
7.321897028698953758e-03
2.843994192835286317e-02
3.652328472779242663e-02
5.976919248128853557e-02
5.578086382840818924e-02
-4.312149138461496278e-02
7.607358466719998935e-02
5.186506528253109760e-02
1.066872150488835103e-01
2.317293301517714399e-02
8.358124769813657373e-02
1.212137536909758118e-01
1.088231327200454568e-01
2.702684551830986104e-02
2.980740712067009301e-02
7.117852449560413408e-02
5.029681501193783433e-02
6.926432731488418870e-02
3.138751560408248320e-02
5.240655701285723556e-02
5.934528699975138988e-02
7.562571076104612766e-02
5.959577823875922276e-02
4.831664684117192854e-03
1.507431192400966735e-02
1.757792668096593014e-03
-5.219913345067189736e-03
-7.026869437085692116e-03
-4.846569770470751659e-03
-5.317193298629660503e-03
-6.900490373682011125e-03
-4.672818975354944837e-03
-5.622143765235121382e-04
1.316040200243101532e-02
-4.197649878046133542e-03
2.545967639584312270e-03
3.191690482571410414e-03
1.116690262505298792e-03
7.411148270822009998e-03
9.477059769268714184e-03
7.852044959877985120e-03
-1.756565812885621525e-03
-4.869098454477943649e-03
-2.685139186935664446e-03
-1.085590845068482024e-02
1.059285359914305391e-02
1.849516730946226817e-02
4.222865377134421561e-02
-8.785324111355796717e-03
1.874835920114170662e-03
9.396433027552286710e-02
5.248701611436867864e-02
6.487698256645951789e-02
9.643773387012782861e-02
7.471527239577763213e-02
9.961300302901632264e-02
8.589476044726551685e-02
3.321503310077345006e-02
-1.211545818919109729e-01
5.532271038215685888e-02
-1.409394383388486438e-01
-8.514245610785636798e-02
-4.886889620580692206e-02
-4.712974967948441174e-02
-2.021370739854932985e-02
-2.971153093296480252e-02
-1.479922118615240034e-02
-1.271505988488993433e-01
1.317582259028932667e-01
4.529932159377814127e-02
1.231348201919263419e-02
-9.872668484965235747e-03
-7.924516778866730338e-02
-5.253905352146087671e-02
-4.088819168557034089e-02
-7.392603214977239157e-02
1.711047770440399240e-03
-3.491752950501547659e-02
-1.346242779247391885e-02
-2.440079125723870757e-02
-1.020757962795454388e-02
3.651582367707101318e-02
5.252042094050879406e-02
4.758564985168128869e-02
2.220446049250313081e-16
8.860686880938839494e-02
8.850994833649650229e-02
6.930848923131482930e-02
1.034439095036600031e-01
7.877308384639736261e-02
1.313369785954572877e-01
1.271483104168850686e-01
6.367449317819257049e-02
3.854436006555339578e-02
4.785932231168799067e-02
6.582239699615949347e-02
-2.446832169975494964e-03
1.222332317369036192e-02
1.034711285034142780e-02
-2.295209704164843934e-03
-1.353755519017434128e-02
-1.346053714582767791e-03
4.093075312305502478e-03
1.933078846524105554e-04
-1.002784315773430635e-02
-1.087087238633070718e-02
-1.189732614960203883e-02
-8.124852809278201859e-03
-4.803677212548401743e-03
-7.919173430258996671e-03
-5.867875309395961803e-03
-9.175338677694863665e-03
9.765872837728312161e-03
1.361864184454894544e-02
9.301200706621270964e-03
-2.026660805014443567e-03
5.906830317137512498e-04
7.382336514353160517e-03
8.410538789687949102e-03
1.535361143379543325e-02
9.231776277094427829e-03
3.122655500871762690e-03
-3.942937463410095544e-03
7.929557208005727498e-03
3.413561032196532619e-03
enter image description herejust got wrong figure[enter image
description here][2], using python 3.7.
import matplotlib.pyplot as plt
import pandas as pd
data = pd.read_csv('data.txt', header=-1)
data.columns =['A']
data.hist('A', bins=20, density=True)
plt.show()

Related

How to avoid overlapping xticklabels in seaborn plot when spacing is narrow

I have the following dataframe:
,ENC,EPM,CPFNN,vMLP
cg19493601,0,0,0,2
cg17435445,0,0,0,2
cg02319392,0,0,0,2
cg04672495,0,0,0,2
cg09089913,0,0,0,2
cg21308111,0,0,0,2
cg03569073,0,0,0,2
cg26750487,0,0,0,1
cg05542262,0,0,0,2
cg19191454,0,0,0,2
cg20160885,0,0,0,2
cg02122467,0,0,0,2
cg27021986,0,0,0,2
cg22671421,0,0,0,2
cg06396762,0,0,0,2
cg03406626,0,0,0,2
cg02376827,0,0,0,2
cg04157865,0,0,0,2
cg14582226,0,0,0,2
cg19572264,0,0,0,2
cg10979436,0,0,0,1
cg15594550,0,0,0,1
cg06623057,0,0,1,1
cg14231987,0,0,0,2
cg14029283,0,0,0,2
cg24473385,0,0,0,1
cg19814830,0,0,0,2
cg14283099,0,0,0,2
cg16092645,0,0,0,2
cg02731774,0,0,0,2
cg19615721,0,0,0,2
cg18220632,0,0,0,1
cg25123102,0,0,0,2
cg04657715,0,0,0,1
cg21115608,0,0,0,2
cg13545874,0,0,0,2
cg11969637,0,0,0,1
cg03400437,0,0,0,2
cg25604067,0,0,0,1
cg20067598,0,0,0,2
cg17578235,0,0,1,1
cg05190577,0,0,0,2
cg04937422,0,0,0,2
cg27390496,0,0,0,2
cg18283673,0,0,0,1
cg01105403,0,0,0,1
cg06315607,0,0,0,2
cg27513574,0,0,0,2
cg10593416,0,0,0,1
cg19523338,0,0,0,1
cg10242862,0,0,0,2
cg01167177,0,0,0,1
cg18599069,0,0,0,2
cg20331814,0,0,0,2
cg10322510,0,0,0,2
cg09120267,0,0,0,1
cg05490132,0,0,0,1
cg02289168,0,0,0,1
cg09241267,0,0,0,1
cg03665605,0,0,0,1
cg20018782,0,0,0,1
cg13018197,0,0,0,2
cg24275159,0,0,0,2
cg14210236,0,0,0,2
cg03417342,0,0,0,1
cg25483123,0,0,0,2
cg03672854,0,0,0,2
cg26674929,0,0,0,2
cg16717099,0,0,0,2
cg14566393,0,0,0,1
cg18685561,0,0,0,1
cg18725681,0,0,0,2
cg13062821,0,0,0,1
cg15962547,0,0,0,2
cg19563510,0,0,0,1
cg25697726,0,0,0,1
cg10068989,0,0,0,2
cg04907885,0,0,0,2
cg16494530,0,0,0,1
cg09289712,0,0,0,2
cg18994446,0,0,0,1
cg10445447,0,0,0,2
cg11762629,0,0,0,2
cg07065737,0,0,0,1
cg14688108,0,1,1,1
cg14989522,0,0,0,1
cg18751682,0,0,0,2
cg17291435,0,0,0,2
cg20792512,0,0,0,2
cg21522303,0,0,0,2
cg09594069,0,0,0,2
cg03523550,0,0,0,2
cg08207707,0,0,0,2
cg06622408,0,0,0,2
cg07359633,0,0,0,2
cg19733833,0,0,1,2
cg10172801,0,0,0,1
cg14911690,0,0,0,2
cg01914744,0,0,0,2
cg20430572,0,0,0,1
cg05904213,0,0,0,2
cg19182423,0,0,0,1
cg15911859,0,0,0,2
cg25767192,0,0,0,2
cg03963391,0,0,0,2
cg25612710,0,0,0,2
cg22636108,0,0,0,2
cg21285525,0,0,1,1
cg11332928,0,0,0,2
cg11480264,0,0,0,1
cg09176740,0,0,0,1
cg14583871,0,0,0,2
cg12845923,0,0,0,1
cg06534313,0,0,0,1
cg04930858,0,0,0,1
cg04281268,0,0,0,2
cg17035899,0,0,1,1
cg18686155,0,0,0,2
cg04651042,0,0,0,2
cg18767088,0,0,1,2
cg10025443,0,0,0,2
cg01475538,0,0,1,1
cg24311272,0,0,0,2
cg18500674,0,0,0,2
cg21748418,0,0,0,1
cg11915997,0,0,0,2
cg03727342,0,0,0,2
cg09073441,0,0,0,2
cg21153962,0,0,0,2
cg02797548,0,0,0,2
cg27388777,0,0,0,2
cg17868287,0,0,0,2
cg01531388,0,0,0,2
cg07768201,0,0,0,2
cg26386968,0,1,1,1
cg14731657,0,0,0,2
cg00155063,0,0,1,2
cg09817427,0,0,0,2
cg22691746,0,0,0,2
cg09571376,0,0,0,1
cg21383280,0,0,0,1
cg21019315,0,0,0,2
cg07824824,0,0,0,1
cg03782778,0,0,0,2
cg20513721,0,0,0,2
cg04757012,0,0,0,2
cg09967192,0,0,0,2
cg26925114,0,0,0,1
cg19412667,0,0,0,2
cg13939664,0,0,0,2
cg15766595,0,0,0,2
cg12041266,0,0,0,2
cg07785447,0,0,0,2
cg13915354,0,0,0,1
cg15512534,0,0,0,1
cg24144083,0,0,1,1
cg17603502,0,0,0,2
cg11999631,0,0,0,2
cg26974111,0,0,1,1
cg09818930,0,0,0,2
cg19518388,0,0,0,2
cg07924892,0,0,0,2
cg03666316,0,0,0,2
cg26006440,0,0,0,2
cg24679567,0,0,0,1
cg15179515,0,0,0,2
cg22542751,0,0,0,2
cg18135796,0,0,0,2
cg22766230,0,0,0,1
cg18043157,0,0,0,1
cg10367023,0,0,0,2
cg07747661,0,0,0,1
cg00915818,0,0,0,2
cg21216268,0,0,0,2
cg09268672,0,0,0,1
cg00641009,0,0,0,2
cg21175685,0,0,0,2
cg09478268,0,0,0,1
cg07452625,0,0,0,2
cg08881785,0,0,0,1
cg18147605,0,0,0,2
cg15202378,0,0,0,2
cg07693657,0,0,0,1
cg02493205,0,0,0,1
cg08376310,0,0,0,2
cg18049142,0,0,0,2
cg16132219,0,0,0,2
cg09112760,0,0,0,2
cg20152891,0,0,0,2
cg12956472,0,0,0,1
cg10151901,0,0,0,2
cg26785154,0,0,0,1
cg01196079,0,0,0,1
cg10227919,0,0,0,1
cg17799601,0,0,0,1
cg22960907,0,0,0,2
cg20932768,0,0,0,2
cg10278931,0,0,0,1
cg13539424,0,0,0,1
cg10188732,0,0,0,2
cg18424968,0,0,0,2
cg13787272,0,0,0,2
cg08642716,0,0,0,2
cg01972418,0,0,0,2
cg21955796,0,0,0,2
cg09796320,0,0,0,1
cg00752480,0,0,0,1
cg20225546,0,0,0,2
cg05529157,0,0,0,1
cg21025501,0,0,0,2
cg24842597,0,0,0,1
cg16700779,0,0,1,2
cg23340104,0,0,0,2
cg03516318,0,0,0,2
cg09560650,0,0,0,1
cg06819687,0,0,0,2
cg00106074,0,0,0,2
cg21965516,0,0,0,1
cg01328119,0,0,0,2
cg13948585,0,0,0,2
cg05494465,0,0,0,2
cg22532475,0,0,0,1
cg00920348,0,0,0,2
cg20938572,0,0,0,2
cg21453831,0,0,0,2
cg04241652,0,0,0,2
cg02757572,0,0,0,2
cg02600349,0,0,0,2
cg02626667,0,0,0,1
cg00611495,0,0,0,1
cg00290373,0,0,0,2
cg07556829,0,0,0,2
cg04497611,0,0,0,2
cg18402615,0,0,0,2
cg18360825,0,0,0,1
cg03702919,0,0,0,2
cg26060489,0,0,0,2
cg13178766,0,0,0,2
cg00401972,0,0,0,1
cg11791710,0,0,0,2
cg19766441,0,0,0,2
cg19961480,0,0,0,2
cg01965950,0,0,0,1
cg19996355,0,0,0,2
cg23292266,0,0,0,2
cg25801502,0,0,0,1
cg22854549,0,0,0,2
cg02105326,0,0,0,2
cg06928993,0,0,0,2
cg08152564,0,0,0,2
cg03867759,0,0,0,2
cg18145196,0,0,0,1
cg08051076,0,0,0,1
cg20946369,0,0,0,1
cg22679120,0,0,0,2
cg21548029,0,0,0,2
cg16715692,0,0,0,1
cg22591433,0,0,0,2
cg13242468,0,0,0,2
cg23169614,0,0,0,2
cg12368612,0,0,0,2
cg19722639,0,0,0,2
cg05027085,0,0,0,2
cg02980621,0,0,0,2
cg10985993,0,0,0,2
cg18997875,0,0,0,2
cg02716556,0,0,0,2
cg01054478,0,0,0,1
cg26381783,0,0,0,2
cg25990363,0,0,0,2
cg17759806,0,0,0,2
cg18589102,0,0,0,2
cg16133088,0,0,0,2
cg04725507,0,0,0,2
cg26748945,0,0,0,2
cg26824709,0,0,0,1
cg25857710,0,0,0,2
cg01616215,0,0,0,2
cg02254554,0,0,0,2
cg06131936,0,0,1,1
cg00913799,0,0,0,2
cg23149687,0,0,0,2
cg25153196,0,0,0,1
cg24695614,0,0,1,1
cg08573355,0,0,0,2
cg02413370,0,0,0,1
cg05204798,0,0,1,1
cg16977596,0,0,0,2
cg09879895,0,0,0,2
cg08541521,0,0,0,2
cg04843615,0,0,0,2
cg00799631,0,0,0,2
cg02540094,0,0,0,2
cg11908557,0,0,0,2
cg06842071,0,0,0,1
cg01323274,0,0,0,2
cg05195017,0,0,0,1
cg05601917,0,0,1,1
cg27079740,0,0,0,1
cg13785536,0,0,0,2
cg22775138,0,0,0,2
cg26230417,0,0,0,2
cg14102055,0,0,0,1
cg07227926,0,0,0,2
cg12804441,0,0,0,2
cg14170181,0,0,0,2
cg06005098,0,0,0,2
cg18569885,0,0,0,1
cg27295716,0,0,0,2
cg06622725,0,0,0,2
cg27603366,0,0,0,2
cg20158796,0,0,0,2
cg14920696,0,0,0,2
cg25722423,0,0,0,2
cg22736354,0,0,0,2
cg03505427,0,0,0,1
cg01217204,0,0,0,2
cg09967647,0,0,0,2
cg22159421,0,0,0,2
cg19995828,0,0,0,2
cg23472930,0,0,0,2
cg00702008,0,0,0,1
cg25534294,0,0,0,1
cg27201301,0,0,0,2
cg25735887,0,0,0,2
cg06208926,0,0,0,1
cg05945782,0,0,0,2
cg01112249,0,0,0,1
cg12781568,0,0,0,2
cg04787317,0,0,0,2
cg07365960,0,0,0,2
cg15435996,0,0,0,1
cg20077393,0,0,0,2
cg15394350,0,0,0,2
cg07793849,0,0,0,2
cg06143732,0,0,0,2
cg17922215,0,0,0,2
cg21619814,0,0,0,1
cg03840496,0,0,0,1
cg00716309,0,0,0,1
cg07023324,0,0,0,1
cg15788149,0,0,1,1
cg02745321,0,0,0,1
cg17273683,0,0,0,1
cg10709593,0,0,0,2
cg25523538,0,0,0,2
cg08210342,0,0,0,1
cg07332683,0,0,0,1
cg14566475,0,0,0,1
cg26116495,0,0,0,2
cg12169365,0,0,0,2
cg02879662,0,0,0,2
cg03867475,0,0,0,2
cg03660500,0,0,0,2
cg22855900,0,0,0,2
cg00076998,0,0,0,2
cg21216010,0,0,0,2
cg22337605,0,0,0,2
cg24663541,0,0,0,2
cg08898442,0,0,0,1
cg17830959,0,0,0,2
cg25617230,0,0,1,1
cg01073605,0,0,0,2
cg07645736,0,0,0,2
cg17906269,0,0,0,2
cg01689641,0,0,0,2
cg21727214,0,0,0,1
ch.11.1543446R,0,0,0,2
cg12897947,0,0,0,2
cg02916525,0,0,0,2
cg20449382,0,0,0,2
cg27050747,0,0,0,1
cg08596000,0,0,0,2
cg15442907,0,0,0,1
cg02422902,0,0,0,2
cg20536512,0,0,0,2
cg15475080,0,0,0,2
cg22484737,0,0,0,2
cg20283971,0,0,0,2
cg08369436,0,0,1,1
cg03598440,0,0,0,1
cg20005056,0,0,0,1
cg09790502,0,0,0,2
cg00009916,0,0,0,1
cg03179043,0,0,0,1
cg04227079,0,0,0,1
cg26931862,0,0,0,1
cg07527324,0,0,0,2
cg26144458,0,0,0,2
cg02245998,0,0,0,1
cg20068496,0,0,0,2
cg04768927,0,0,0,2
cg08097877,0,0,0,1
cg03957204,0,0,0,1
cg07967210,0,0,0,2
cg11227822,0,0,0,2
cg12738979,0,0,0,2
cg23501567,0,0,0,1
cg14539442,0,1,1,1
cg04471454,0,0,0,2
cg04012618,0,0,0,2
cg03738352,0,0,0,2
cg06510397,0,0,0,2
cg03809954,0,0,0,1
cg02028389,0,0,0,2
cg09308829,0,0,0,2
cg03930532,0,0,0,2
cg09383860,0,0,0,1
cg08798933,0,0,0,2
cg04969688,0,0,0,1
cg07311521,0,0,0,2
cg21586215,0,0,0,2
cg18356159,0,0,0,2
cg04497154,0,0,0,1
cg08146865,0,0,0,2
cg18589016,0,0,0,2
cg05397886,0,0,0,1
cg13679048,0,0,0,2
cg21946299,0,0,0,2
cg19788741,0,0,0,2
cg04323979,0,0,0,1
cg13580857,0,0,0,2
cg08016802,0,0,0,2
cg18319687,0,0,0,1
cg00257542,0,0,0,1
cg26512993,0,0,0,1
cg02117859,0,0,0,1
cg21622555,0,0,0,2
cg00540941,0,0,0,1
cg24332767,0,0,0,2
cg02052774,0,0,0,2
cg15627380,0,0,0,1
cg22562590,0,0,0,1
cg00871979,0,0,0,1
cg04012364,0,0,0,2
cg15952045,0,0,0,1
cg13576200,0,0,0,1
cg22264014,0,0,0,2
cg26673648,0,0,0,1
cg01381130,0,0,0,1
cg22294804,0,0,0,2
cg01727686,0,0,0,1
cg21932368,0,0,0,2
cg06536629,0,0,0,2
cg10915772,0,0,0,1
cg18449721,0,0,0,2
cg19697530,0,0,0,2
cg19253643,0,0,0,1
cg26635603,0,0,0,1
cg00517407,0,0,0,2
cg21291641,0,0,0,2
cg13914598,0,0,0,2
cg05516842,0,0,0,1
cg03187614,0,0,0,1
cg05272099,0,0,0,2
cg10661615,0,0,0,2
cg05601623,0,0,0,2
cg13118545,0,0,0,2
cg12690313,0,0,0,2
cg06369090,0,0,0,2
cg08743392,0,0,0,2
cg02276361,0,0,0,1
cg08915922,0,0,0,2
cg04169908,0,0,0,1
cg12440258,0,0,0,2
cg26986937,0,0,0,2
cg22606205,0,0,0,2
cg27168632,0,0,0,2
cg25609143,0,0,0,2
cg01273565,0,0,0,2
cg08506672,0,0,0,1
cg22675486,0,0,0,2
cg05063395,0,0,0,2
cg01405761,0,0,0,2
cg10373196,0,0,0,2
cg00761129,0,0,0,2
cg14946515,0,0,0,2
cg25841943,0,0,0,2
cg25004270,0,1,1,1
cg19190269,0,0,0,2
cg03064832,0,0,0,2
cg17199468,0,0,0,2
cg22387756,0,0,0,1
cg04257169,0,0,0,2
cg09763325,0,0,0,2
cg12034118,0,0,0,2
cg13159559,0,0,0,2
cg17353057,0,0,0,2
cg00140191,0,0,1,1
cg06390079,0,0,0,2
cg01201782,0,0,0,2
cg09457801,0,0,0,2
cg06516800,0,0,0,1
cg24938727,0,0,0,2
cg05198733,0,0,0,1
cg01897756,0,0,0,2
cg01212071,0,0,0,2
cg25284762,0,0,0,1
cg21024422,0,0,0,1
cg06553513,0,0,0,2
cg10976318,0,0,0,2
cg13742526,0,0,0,2
cg08005992,0,0,0,2
cg11807492,0,0,0,2
cg25190513,0,0,0,1
cg14416559,0,0,0,2
cg02086801,0,0,0,2
cg02525995,0,0,0,1
cg24018756,0,0,0,1
cg27056129,0,0,0,2
cg18753594,0,0,0,2
cg01159380,0,0,1,1
cg23620822,0,0,0,2
cg01163842,0,0,0,2
cg22947959,0,0,0,1
cg18396811,0,0,0,2
cg26470101,0,0,0,1
cg00570697,0,0,0,2
cg23727043,0,0,1,2
cg07330196,0,0,0,1
cg05784562,0,0,0,1
cg08715988,0,0,0,1
cg05979118,0,0,0,2
cg12148940,0,0,0,1
cg08579962,0,0,0,1
cg04845171,0,0,0,1
cg03149432,0,0,0,1
cg20440575,0,0,0,2
cg13657659,0,0,0,2
cg04849201,0,0,0,1
cg19147912,0,0,0,1
cg12728517,0,0,0,2
cg03447530,0,0,0,1
cg21184800,0,0,0,2
cg11362449,0,0,0,1
cg12311636,0,0,0,1
cg06437740,0,0,0,1
cg03999216,0,0,0,2
cg17477493,0,0,0,1
cg22259778,0,0,0,1
cg10120572,0,0,0,1
cg07797660,0,0,0,2
cg08677954,0,0,0,2
cg06635552,0,0,0,2
cg09899094,0,0,0,2
cg13845147,0,0,0,2
cg23037132,0,0,0,2
cg15262505,0,0,0,2
cg00056489,0,0,0,2
cg09759737,0,0,0,1
cg12188268,0,0,0,2
cg24011500,0,0,0,1
cg15002713,0,0,0,1
cg13817545,0,0,0,2
cg03553786,0,0,0,2
cg06218627,0,0,0,2
cg17298884,0,0,0,1
cg18231614,0,0,0,2
cg14835981,0,0,0,1
cg08418980,0,0,0,2
cg14007549,0,0,0,2
cg08317133,0,1,1,1
cg26741350,0,0,1,1
cg01682784,0,0,0,2
cg17279652,0,0,0,1
cg05128414,0,0,0,1
cg04132146,0,0,0,2
cg23970331,0,0,0,1
cg15521264,0,0,0,2
cg07291005,0,0,0,2
cg27194152,0,0,0,1
cg10403934,0,0,0,1
cg10922264,0,0,0,1
cg22583444,0,0,0,1
cg18507707,0,0,0,2
cg02761568,0,0,0,2
cg05495029,0,0,0,2
cg08645889,0,0,1,2
cg00945293,0,0,0,2
cg25501930,0,0,0,1
cg10090836,0,0,0,1
cg15189070,0,0,0,1
cg10497884,0,0,0,2
cg26345216,0,0,0,1
cg09566131,0,0,0,2
cg09561280,0,0,0,2
cg11296715,0,0,0,2
cg26659805,0,0,0,2
cg01449168,0,0,0,2
cg00896540,0,0,0,2
cg21963854,0,0,0,2
cg16240137,0,0,0,1
cg23050300,0,0,0,2
cg08471800,0,0,0,2
cg07905273,0,0,0,2
cg24277586,0,0,0,1
cg03871549,0,0,0,2
cg00123181,0,0,0,2
cg06549530,0,0,0,2
cg02535735,0,0,0,1
cg04327529,0,0,0,2
cg17639046,0,0,0,2
cg01082601,0,0,0,2
cg19042136,0,0,0,2
cg10846615,0,0,1,1
cg17179051,0,0,0,1
cg05184917,0,0,0,2
cg27271756,0,0,0,2
cg07823913,0,0,0,1
cg01040169,0,0,0,1
cg09441152,0,0,0,2
cg23623107,0,0,0,1
cg16622863,0,0,0,2
cg22358236,0,0,0,2
cg08153404,0,0,0,2
cg19317333,0,0,0,2
cg20548032,0,0,0,1
cg13824156,0,0,0,1
cg06237092,0,0,0,2
cg19090522,0,0,0,1
cg06679538,0,0,0,2
cg21834739,0,0,0,2
cg18626098,0,0,0,2
cg13717425,0,0,0,2
cg12876900,0,0,0,1
cg16050974,0,0,0,2
cg19499998,0,0,1,1
cg00877056,0,0,0,1
cg10607485,0,0,0,2
cg18275316,0,0,1,1
cg24040576,0,0,0,1
cg19238531,0,0,0,2
cg07202110,0,0,0,1
cg08276984,0,0,0,2
cg26281453,0,0,0,2
cg14354327,0,0,0,1
cg25397973,0,0,0,2
cg09449449,0,0,0,2
cg06023349,0,0,0,2
cg19968946,0,0,0,2
cg10962407,0,0,0,1
cg24044238,0,0,0,2
cg19987142,0,0,0,2
cg25575845,0,0,0,1
cg05121812,0,0,0,2
cg12671565,0,0,0,2
cg01802295,0,0,0,2
cg11372696,0,0,0,1
cg14371636,0,0,0,2
cg00500498,0,0,0,2
cg11278260,0,0,0,2
cg07468260,0,0,0,2
cg13536051,0,0,1,1
cg13353683,0,0,0,2
cg13873762,0,0,0,2
cg18537571,0,0,0,2
cg07429394,0,0,0,2
ch.X.703923F,0,0,0,1
cg16562486,0,0,0,2
cg26932226,0,0,0,2
cg02250708,0,0,0,1
cg22354618,0,0,0,2
cg19671246,0,0,0,2
cg11442717,0,0,0,1
cg04941630,0,0,0,2
cg19995539,0,0,0,1
cg24341220,0,0,0,2
cg05670459,0,0,0,2
cg17706896,0,0,0,2
cg19855618,0,0,0,2
cg10778240,0,0,0,2
cg20078119,0,0,0,2
cg26879788,0,0,0,1
cg20776947,0,0,0,2
cg26377880,0,0,0,2
cg07791065,0,0,0,2
cg23086176,0,0,0,1
cg04864083,0,0,0,2
cg23719318,0,0,0,2
cg27403098,0,0,0,2
cg03720043,0,0,0,2
cg16256065,0,0,0,1
cg16837557,0,0,0,2
cg17662493,0,0,1,1
cg11505338,0,0,0,1
cg04878644,0,0,0,2
cg18710784,0,0,0,1
cg17152214,0,0,0,1
cg10865856,0,0,0,1
cg03868159,0,0,0,2
cg15439078,0,0,1,1
cg24223558,0,0,0,1
cg14480858,0,0,0,2
cg09644356,0,0,0,1
cg04100684,0,0,0,2
cg04760708,0,0,0,2
cg27373972,0,0,0,1
cg25181749,0,0,0,1
cg10251973,0,0,0,2
cg20172500,0,0,0,1
cg25883405,0,0,0,2
cg06932776,0,0,0,2
cg11188679,0,0,0,2
cg23328050,0,0,0,2
cg16107322,0,0,0,2
cg04552470,0,0,0,2
cg08393356,0,0,0,1
cg01284869,0,0,0,2
cg07896108,0,0,0,1
cg22571393,0,0,1,1
cg18988170,0,0,0,2
cg16592453,0,0,0,1
cg06211255,0,0,0,2
cg22426938,0,0,0,2
cg03944089,0,0,0,2
cg09595479,0,0,0,2
cg26258845,0,0,0,1
cg09892203,0,0,0,1
cg00221327,0,0,0,1
cg27504292,0,0,0,2
cg19267760,0,0,0,1
cg26864395,0,0,0,2
cg12856183,0,0,0,2
cg07829465,0,0,0,1
cg15215830,0,0,0,2
cg14318942,0,0,0,2
cg11229715,0,0,0,2
cg11691189,0,0,0,1
cg12991830,0,0,0,2
cg22699052,0,0,1,1
cg09485472,0,0,0,1
cg14752227,0,0,1,1
cg04787343,0,0,0,2
cg11746846,0,0,0,1
cg17852021,0,0,0,2
cg15120477,0,0,0,1
cg24572400,0,0,0,2
cg00117869,0,0,0,1
cg01216607,0,0,0,2
cg17222164,0,0,0,2
cg01204964,0,0,1,1
cg07955004,1,1,1,1
cg04371440,0,0,0,2
cg15035364,0,0,0,2
cg19710662,0,0,0,1
cg16595365,0,0,0,2
cg03370106,0,0,0,1
cg18571419,0,0,0,2
cg20624137,0,0,0,1
cg15412736,0,0,0,2
cg00889769,0,0,0,2
cg14649140,0,0,0,2
cg25531618,0,0,0,1
cg07594031,0,0,0,2
cg05816239,0,0,0,2
cg00295604,0,0,0,2
cg04941721,0,0,0,2
cg11613164,0,0,0,2
cg02387679,0,0,0,2
cg22134372,0,0,0,2
cg27099166,0,0,0,2
cg09735674,0,0,0,1
cg23173517,0,0,0,2
cg20713333,0,0,0,1
cg01520402,0,0,0,1
cg00328593,0,0,0,2
cg17348479,0,0,0,1
cg26643142,0,0,0,2
cg14575053,0,0,0,2
cg05092885,0,0,0,1
cg08620751,0,0,0,1
cg21562321,0,0,0,1
cg22374901,0,0,0,2
cg27613976,0,0,0,2
cg06127885,0,0,1,1
cg14840664,0,0,0,1
cg25045242,0,0,0,1
cg12747844,0,0,0,1
cg14534464,0,0,0,2
cg21508023,0,0,0,2
cg13417559,0,0,0,2
cg14461650,0,0,0,1
cg03885264,0,0,0,2
cg02868338,0,0,0,2
cg08846467,0,0,0,2
cg27565938,0,0,0,1
cg08904363,0,0,0,2
cg12253071,0,0,0,1
cg06259664,0,1,1,1
cg18453904,0,0,0,2
cg19144392,0,0,0,1
cg16189596,0,0,0,2
And I want to create a seaborn heatmap like this:
plt.figure(figsize=(470, 60))
sns.set(font_scale = 14)
df=comparison.T
# create a Boolean mask of df
mask = df.ge(1).all()
# use the mask to update a list of labels
cols = [col if m else '' for (col, m) in zip(df.columns, mask)]
# plot with custom labels
ax = sns.heatmap(df, xticklabels=cols,cmap="crest_r")
ax.set_xticklabels(labels=cols, fontsize=200)
plt.show()
However, sometimes due to the narrow space the xtick labels overlap. Is there any way to add more spacing while still providing a readable image (not too small so that it cannot be read) or to put them one below the other?

seaborn not plotting scatterplot as expected

I have written the following simple code :
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
advertising = pd.read_csv("tv-marketing.csv")
sns.pairplot(advertising, x_vars=[
'TV'], y_vars='Sales', height=7, aspect=0.7)
The following is the .csv file that is being used here -
TV,Sales
230.1,22.1
44.5,10.4
17.2,9.3
151.5,18.5
180.8,12.9
8.7,7.2
57.5,11.8
120.2,13.2
8.6,4.8
199.8,10.6
66.1,8.6
214.7,17.4
23.8,9.2
97.5,9.7
204.1,19
195.4,22.4
67.8,12.5
281.4,24.4
69.2,11.3
147.3,14.6
218.4,18
237.4,12.5
13.2,5.6
228.3,15.5
62.3,9.7
262.9,12
142.9,15
240.1,15.9
248.8,18.9
70.6,10.5
292.9,21.4
112.9,11.9
97.2,9.6
265.6,17.4
95.7,9.5
290.7,12.8
266.9,25.4
74.7,14.7
43.1,10.1
228,21.5
202.5,16.6
177,17.1
293.6,20.7
206.9,12.9
25.1,8.5
175.1,14.9
89.7,10.6
239.9,23.2
227.2,14.8
66.9,9.7
199.8,11.4
100.4,10.7
216.4,22.6
182.6,21.2
262.7,20.2
198.9,23.7
7.3,5.5
136.2,13.2
210.8,23.8
210.7,18.4
53.5,8.1
261.3,24.2
239.3,15.7
102.7,14
131.1,18
69,9.3
31.5,9.5
139.3,13.4
237.4,18.9
216.8,22.3
199.1,18.3
109.8,12.4
26.8,8.8
129.4,11
213.4,17
16.9,8.7
27.5,6.9
120.5,14.2
5.4,5.3
116,11
76.4,11.8
239.8,12.3
75.3,11.3
68.4,13.6
213.5,21.7
193.2,15.2
76.3,12
110.7,16
88.3,12.9
109.8,16.7
134.3,11.2
28.6,7.3
217.7,19.4
250.9,22.2
107.4,11.5
163.3,16.9
197.6,11.7
184.9,15.5
289.7,25.4
135.2,17.2
222.4,11.7
296.4,23.8
280.2,14.8
187.9,14.7
238.2,20.7
137.9,19.2
25,7.2
90.4,8.7
13.1,5.3
255.4,19.8
225.8,13.4
241.7,21.8
175.7,14.1
209.6,15.9
78.2,14.6
75.1,12.6
139.2,12.2
76.4,9.4
125.7,15.9
19.4,6.6
141.3,15.5
18.8,7
224,11.6
123.1,15.2
229.5,19.7
87.2,10.6
7.8,6.6
80.2,8.8
220.3,24.7
59.6,9.7
0.7,1.6
265.2,12.7
8.4,5.7
219.8,19.6
36.9,10.8
48.3,11.6
25.6,9.5
273.7,20.8
43,9.6
184.9,20.7
73.4,10.9
193.7,19.2
220.5,20.1
104.6,10.4
96.2,11.4
140.3,10.3
240.1,13.2
243.2,25.4
38,10.9
44.7,10.1
280.7,16.1
121,11.6
197.6,16.6
171.3,19
187.8,15.6
4.1,3.2
93.9,15.3
149.8,10.1
11.7,7.3
131.7,12.9
172.5,14.4
85.7,13.3
188.4,14.9
163.5,18
117.2,11.9
234.5,11.9
17.9,8
206.8,12.2
215.4,17.1
284.3,15
50,8.4
164.5,14.5
19.6,7.6
168.4,11.7
222.4,11.5
276.9,27
248.4,20.2
170.2,11.7
276.7,11.8
165.6,12.6
156.6,10.5
218.5,12.2
56.2,8.7
287.6,26.2
253.8,17.6
205,22.6
139.5,10.3
191.1,17.3
286,15.9
18.7,6.7
39.5,10.8
75.5,9.9
17.2,5.9
166.8,19.6
149.7,17.3
38.2,7.6
94.2,9.7
177,12.8
283.6,25.5
232.1,13.4
This is the output graph that I am getting (Running it from vscode->Run Current File
in Interactive Window
vscode output
But the expected output form the example that I took should be like this :
expected output 1
expected output 2
**Neither do I see the scatterplot, also the scaling is different.**
I believe the code you are looking for is the following:
sns.scatterplot(x='TV', y='Sales', data=advertising)
If you want to use pairplot then you can use:
sns.pairplot(advertising, height=7, aspect=0.7)
or:
sns.pairplot(sample_data, x_vars=['TV'], y_vars=['Sales'], height=7, aspect=0.7, kind='scatter', diag_kind=None)

Altair - Gradient above line

I want to create an area chart, however the gradient should run from the line up to the top of the chart. Any ideas?
example of a regular gradient chart here https://altair-viz.github.io/gallery/area_chart_gradient.html
alt.Chart(source).transform_filter(
'datum.symbol==="GOOG"'
).mark_area(
line={'color':'darkgreen'},
color=alt.Gradient(
gradient='linear',
stops=[alt.GradientStop(color='white', offset=0),
alt.GradientStop(color='darkgreen', offset=1)],
x1=1,
x2=1,
y1=1,
y2=0
)
).encode(
alt.X('date:T'),
alt.Y('price:Q')
)
You can do this by setting the y2 encoding to alt.value(0) – the zero in this case measures pixels from the top of the chart axis:
import altair as alt
from vega_datasets import data
source = data.stocks()
alt.Chart(source).transform_filter(
'datum.symbol==="GOOG"'
).mark_area(
line={'color':'darkgreen'},
color=alt.Gradient(
gradient='linear',
stops=[alt.GradientStop(color='white', offset=0),
alt.GradientStop(color='darkgreen', offset=1)],
x1=1,
x2=1,
y1=1,
y2=0
)
).encode(
alt.X('date:T'),
alt.Y('price:Q'),
y2=alt.value(0)
)

Get slope and itercept from a matched linear regression model in scikit-learn

I have a simple model
from sklearn import linear_model
x =[6.1101, 5.5277, 8.5186, 7.0032, 5.8598, 8.3829, 7.4764, 8.5781, 6.4862, 5.0546, 5.7107, 14.164, 5.734, 8.4084, 5.6407, 5.3794, 6.3654, 5.1301, 6.4296, 7.0708, 6.1891, 20.27, 5.4901, 6.3261, 5.5649, 18.945, 12.828, 10.957, 13.176, 22.203, 5.2524, 6.5894, 9.2482, 5.8918, 8.2111, 7.9334, 8.0959, 5.6063, 12.836, 6.3534, 5.4069, 6.8825, 11.708, 5.7737, 7.8247, 7.0931, 5.0702, 5.8014, 11.7, 5.5416, 7.5402, 5.3077, 7.4239, 7.6031, 6.3328, 6.3589, 6.2742, 5.6397, 9.3102, 9.4536, 8.8254, 5.1793, 21.279, 14.908, 18.959, 7.2182, 8.2951, 10.236, 5.4994, 20.341, 10.136, 7.3345, 6.0062, 7.2259, 5.0269, 6.5479, 7.5386, 5.0365, 10.274, 5.1077, 5.7292, 5.1884, 6.3557, 9.7687, 6.5159, 8.5172, 9.1802, 6.002, 5.5204, 5.0594, 5.7077, 7.6366, 5.8707, 5.3054, 8.2934, 13.394, 5.4369]
y = [17.592, 9.1302, 13.662, 11.854, 6.8233, 11.886, 4.3483, 12, 6.5987, 3.8166, 3.2522, 15.505, 3.1551, 7.2258, 0.71618, 3.5129, 5.3048, 0.56077, 3.6518, 5.3893, 3.1386, 21.767, 4.263, 5.1875, 3.0825, 22.638, 13.501, 7.0467, 14.692, 24.147, -1.22, 5.9966, 12.134, 1.8495, 6.5426, 4.5623, 4.1164, 3.3928, 10.117, 5.4974, 0.55657, 3.9115, 5.3854, 2.4406, 6.7318, 1.0463, 5.1337, 1.844, 8.0043, 1.0179, 6.7504, 1.8396, 4.2885, 4.9981, 1.4233, -1.4211, 2.4756, 4.6042, 3.9624, 5.4141, 5.1694, -0.74279, 17.929, 12.054, 17.054, 4.8852, 5.7442, 7.7754, 1.0173, 20.992, 6.6799, 4.0259, 1.2784, 3.3411, -2.6807, 0.29678, 3.8845, 5.7014, 6.7526, 2.0576, 0.47953, 0.20421, 0.67861, 7.5435, 5.3436, 4.2415, 6.7981, 0.92695, 0.152, 2.8214, 1.8451, 4.2959, 7.2029, 1.9869, 0.14454, 9.0551, 0.61705]
# Create linear regression object
regr = linear_model.LinearRegression()
# Train the model using the training sets
regr.fit([x], [y])
#where x and y are arrays of values
I need to get the slope and intercept. I tried regr.intercept_ but it returns a large array of numbers that I do not understand what it is.
You should do something like this to get the correct results:
import numpy as np
regr.fit(np.array(x).reshape(-1, 1), np.array(y).reshape(-1, 1))

What is the proper way to employ date2num for timestamps using candlestick_ohlc

My data looks like this (Date, Open, High, Low, Close):
ohlc = [
[1502929058, 1.2652, 1.2653, 1.265, 1.2653],
[1502929059, 1.267, 1.267, 1.267, 1.267],
[1502929060, 1.2655, 1.2656, 1.2655, 1.2656],
[1502929061, 1.2652, 1.2653, 1.2652, 1.2653],
[1502929062, 1.2631, 1.2631, 1.263, 1.2631],
[1502929063, 1.2625, 1.2625, 1.2625, 1.2625],
[1502929064, 1.2619, 1.2619, 1.2619, 1.2619],
[1502929065, 1.2622, 1.2623, 1.2622, 1.2623],
[1502929066, 1.2622, 1.2623, 1.2622, 1.2623],
[1502929067, 1.2617, 1.262, 1.2617, 1.262]
]
and I'm using the code blow to plot the candlesticks:
for row in ohlc:
row[0] = mdates.date2num(datetime.datetime.fromtimestamp(row[0]))
fig = plt.figure()
ax1 = plt.subplot2grid((1,1), (0,0))
candlestick_ohlc(ax1,ohlc,width=0.1)
fig.subplots_adjust(bottom=0.3)
ax1.xaxis.set_major_formatter(mdates.DateFormatter('%y-%m-%d %H:%M:%S'))
for label in ax1.xaxis.get_ticklabels():
label.set_rotation(45)
plt.xlabel('Date')
plt.ylabel('Price')
plt.show()
but the candlesticks being drawn on top of each other:
as I checked the code further, I noticed that mdates.date2num(datetime.datetime.fromtimestamp(row[0])) is actually generating dates with very minute differences (and therefore candlesticks being drawn on top of each other):
736558.1997453704
736558.1997569444
736558.1997685186
736558.1997800926
736558.1997916667
736558.1998032407
736558.1998148148
736558.1998263889
736558.199837963
736558.199849537
what is the solution to this problem?

Resources