What is the proper way to employ date2num for timestamps using candlestick_ohlc - python-3.x

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?

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?

Remove repeating values from X axis label in Altair

I am having trouble with Altair repeating X axis label values.
Data:
rule_abbreaviation flagged_claim bill_month
0 CONCIDPROC 1 Apr2022
1 CONTUSMAT1 1 Apr2022
2 COVID05 1 Jun2021
3 FILTROTUB2 1 Sep2021
4 MEPIARTRO1 1 Mar2022
#Code to generate Altair Bar Chart
bar = alt.Chart(Data).mark_bar().encode(
x=alt.X('flagged_claim:Q', axis=alt.Axis(title='Flagged Claims', format= ',.0f'), stack='zero'),
y=alt.Y('rule_abbreaviation:N', axis=alt.Axis(title='Component Abbreviation'), sort=alt.SortField(field=measure, order='descending')),
tooltip=[alt.Tooltip('max(ClaimRuleName):N', title='Claim Component'), alt.Tooltip('flagged_claim:Q', title='Flagged Claims', format= ',.0f')],
color=alt.Color('bill_month', legend=None)
).properties(width=485,
title = alt.TitleParams(text = 'Bottom Components',
font = 'Arial',
fontSize = 16,
color = '#000080',
)
).interactive()
X axis label generated by this chart contains repeated 0 and 1
Image of Visualization: https://i.stack.imgur.com/0XdWB.png
The reason this is happening is because you have format= ',.0f' which tells Altair to include 0 decimals in the axis labels. Remove it or change to 1f to see decimals in the labels. In general, a good way to troubleshoot problems like this is to remove part of your code at a time to identify which part is causing the unexpected behavior.
To reduce the number of ticks you can use alt.Axis(title='Flagged Claims', format='d', tickCount=1) or alt.Axis(title='Flagged Claims', format='d', values=[0, 1]). See also Changing Number of y-axis Ticks in Altair

How to fix "Key Error :'not in index' " error in Jupyter Notebooks

The code is to plot the colored graph of the total number of cases in red and recovered cases in green.
There is a key error of not in the index, I checked the spelling and also the syntax, Stil can't find the solution.
#Visulizating Data using Seaborn
f, ax = plt.subplots(figsize=(12, 8))
data = df_full[['Name of the State / UT', 'Total Confirmed Cases (Indian National)', 'Recovered',
'Deaths']]
data.sort_values('Total cases', ascending=False, inplace=True)
sns.set_color_codes("pastel")
sns.barplot(x="Total Confirmed Cases (Indian National)", y="Name of the State / UT",
data=data,lable="Total", color="r")
sns.set_color_codes("muted")
sns.barplot(x="Recovred", y="Name of the State / UT", data=data,label="Reccovered", color="g")
#ADD a legend and informative axis label
ax.legend(ncol=2, loc="lower right", frameon=True)
ax.set(xlim=(0, 35), ylabel="", xlabel="Cases")
sns.despine(left=True, bottom=True)
**ERROR**
KeyError: "['Name of the State / UT'] not in index"

Obtaining hyperpolarization depth from electrophysiological graph

I am working on electrophysiological data which is in .abf format.
I want to obtain the hyperpolarization depth as indicated above in the figure. This is what I have done so far;
import matplotlib.pyplot as plt
import pyabf
import pandas as pd
abf = pyabf.ABF("test.abf")
abf.setSweep(10) # I can access a given sweep. Here sweep 10
df = pd.DataFrame({'time': abf.sweepX, 'current':abf.sweepY})
df1 = df.loc[15650:15800]
df1.plot(x='time', y='current')
I am thinking to apply change in derivative to find the first point of interest (x1,y1) and then lower point (x2,y2), but it looks complex. I would appreciate if someone give some hint or procedure.
The dataset as follow,
time current
0.7825 -63.323975
0.78255 -63.171387
0.7826 -62.89673
0.78265 -62.713623
0.7827 -62.469482
0.78275 -62.37793
0.7828 -62.10327
0.78285 -61.950684
0.7829 -61.76758
0.78295 -61.584473
0.783 -61.401367
0.78305 -61.24878
0.7831 -61.035156
0.78315 -60.85205
0.7832 -60.72998
0.78325 -60.516357
0.7833 -60.455322
0.78335 -60.2417
0.7834 -60.08911
0.78345 -59.96704
0.7835 -59.814453
0.78355 -59.661865
0.7836 -59.509277
0.78365 -59.417725
0.7837 -59.23462
0.78375 -59.11255
0.7838 -58.95996
0.78385 -58.86841
0.7839 -58.685303
0.78395 -58.59375
0.784 -58.441162
0.78405 -58.34961
0.7841 -58.19702
0.78415 -58.044434
0.7842 -57.922363
0.78425 -57.769775
0.7843 -57.678223
0.78435 -57.434082
0.7844 -57.34253
0.78445 -56.9458
0.7845 -56.274414
0.78455 -54.96216
0.7846 -53.253174
0.78465 -51.208496
0.7847 -48.950195
0.78475 -46.325684
0.7848 -43.09082
0.78485 -38.42163
0.7849 -31.036377
0.78495 -22.033691
0.785 -13.397217
0.78505 -6.072998
0.7851 -0.61035156
0.78515 2.7160645
0.7852 3.9367676
0.78525 3.4179688
0.7853 1.3427734
0.78535 -1.4953613
0.7854 -5.0964355
0.78545 -9.185791
0.7855 -13.641357
0.78555 -18.249512
0.7856 -23.132324
0.78565 -27.98462
0.7857 -32.714844
0.78575 -37.261963
0.7858 -41.47339
0.78585 -45.22705
0.7859 -48.553467
0.78595 -51.54419
0.786 -53.985596
0.78605 -56.18286
0.7861 -58.013916
0.78615 -59.539795
0.7862 -60.760498
0.78625 -61.88965
0.7863 -62.652588
0.78635 -63.323975
0.7864 -63.934326
0.78645 -64.2395
0.7865 -64.60571
0.78655 -64.78882
0.7866 -65.00244
0.78665 -64.971924
0.7867 -65.093994
0.78675 -65.03296
0.7868 -64.971924
0.78685 -64.819336
0.7869 -64.78882
0.78695 -64.66675
0.787 -64.48364
0.78705 -64.42261
0.7871 -64.2395
0.78715 -64.11743
0.7872 -63.964844
0.78725 -63.842773
0.7873 -63.659668
0.78735 -63.568115
0.7874 -63.446045
0.78745 -63.26294
0.7875 -63.171387
0.78755 -62.98828
0.7876 -62.89673
0.78765 -62.74414
0.7877 -62.713623
0.78775 -62.530518
0.7878 -62.438965
0.78785 -62.37793
0.7879 -62.25586
0.78795 -62.164307
0.788 -62.042236
0.78805 -62.01172
0.7881 -61.88965
0.78815 -61.88965
0.7882 -61.73706
0.78825 -61.706543
0.7883 -61.645508
0.78835 -61.61499
0.7884 -61.523438
0.78845 -61.462402
0.7885 -61.431885
0.78855 -61.340332
0.7886 -61.37085
0.78865 -61.279297
0.7887 -61.279297
0.78875 -61.157227
0.7888 -61.187744
0.78885 -61.09619
0.7889 -61.157227
0.78895 -61.12671
0.789 -61.09619
0.78905 -61.12671
0.7891 -61.00464
0.78915 -61.00464
0.7892 -60.97412
0.78925 -60.97412
0.7893 -60.943604
0.78935 -61.00464
0.7894 -60.913086
0.78945 -60.97412
0.7895 -60.943604
0.78955 -60.913086
0.7896 -60.943604
0.78965 -60.85205
0.7897 -60.85205
0.78975 -60.821533
0.7898 -60.88257
0.78985 -60.88257
0.7899 -60.913086
0.78995 -60.88257
0.79 -60.913086
We can plot the difference in current between consecutive points (which essentially is to a constant factor the derivative, since times are evenly spaced). First chart shows the actual diffs. Based on this we can set some threshold, such as 0.3, and apply it to filter the main DataFrame. The filtered values are shown in orange on the second chart:
fig, ax = plt.subplots(2, figsize=(8,8))
# plot derivative
df['current'].diff().plot(ax=ax[0])
# current
threshold = 0.4
df['filtered'] = df.loc[df['current'].diff().abs() > threshold]
df.plot(ax=ax[1])
# add spans
x = df['filtered'].dropna()
ax[1].axhspan(x.iloc[0], x.iloc[-1], alpha=0.3, edgecolor='skyblue', facecolor="none", hatch='////')
ax[1].axvspan(x.index.min(), x.index.max(), alpha=0.3, edgecolor='orange', facecolor="none", hatch='\\\\')
Output:
If you're interested in range values, you can dropna values in the filtered subset and find min and max from the index:
print('min', df['filtered'].dropna().index.min())
print('max', df['filtered'].dropna().index.max())
Output:
min 0.78445
max 0.7865
For the value of the gap you can use:
abs(df['filtered'].dropna().iloc[-1] - df['filtered'].dropna().iloc[0])
Output:
7.6599100000000035
Note: We can alternatively also get left edges of these spans as points where diff in the point is lower than the threshold and diff in the next point is higher than the threshold, and similarly for the right edges. This would also work in case we have multiple peaks:
threshold = 0.3
x = df['current'].diff().abs()
spanA = df.loc[(x < threshold) & (x.shift(-1) >= threshold)]
spanB = df.loc[(x >= threshold) & (x.shift(-1) < threshold)]
print(spanA)
current
time
0.7844 -57.34253
print(spanB)
current
time
0.7865 -64.60571

How to fit multiple spectra to a spectrum by extracting the coefficients from a least-squares linear fit?

I want to fit two different spectra to my original spectrum. The two different spectra have x and y values of:
x_1 = 1700.42
1700.9
1701.38
1701.86
1702.34
1702.83
1703.31
1703.79
1704.27
1704.75
1705.24
1705.72
1706.2
1706.68
1707.17
1707.65
1708.13
1708.61
1709.09
1709.58
1710.06
1710.54
1711.02
1711.5
1711.99
1712.47
1712.95
1713.43
1713.91
1714.4
1714.88
1715.36
1715.84
1716.33
1716.81
1717.29
1717.77
1718.25
1718.74
1719.22
1719.7
1720.18
1720.66
1721.15
1721.63
1722.11
1722.59
1723.08
1723.56
1724.04
1724.52
1725
1725.49
1725.97
1726.45
1726.93
1727.41
1727.9
1728.38
1728.86
1729.34
1729.82
1730.31
1730.79
1731.27
1731.75
1732.24
1732.72
1733.2
1733.68
1734.16
1734.65
1735.13
1735.61
1736.09
1736.57
1737.06
1737.54
1738.02
1738.5
1738.98
1739.47
1739.95
1740.43
1740.91
1741.4
1741.88
1742.36
1742.84
1743.32
1743.81
1744.29
1744.77
1745.25
1745.73
1746.22
1746.7
1747.18
1747.66
1748.14
1748.63
1749.11
1749.59
1750.07
1750.56
y_1 = 0.00285
0.00289
0.00290
0.00292
0.00297
0.00304
0.00310
0.00314
0.00319
0.00323
0.00327
0.00333
0.00340
0.00344
0.00347
0.00352
0.00358
0.00364
0.00369
0.00374
0.00382
0.00388
0.00392
0.00397
0.00403
0.00408
0.00414
0.00420
0.00428
0.00436
0.00444
0.00451
0.00456
0.00461
0.00468
0.00474
0.00480
0.00486
0.00493
0.00501
0.00509
0.00517
0.00524
0.00530
0.00535
0.00543
0.00551
0.00558
0.00564
0.00571
0.00578
0.00587
0.00594
0.00599
0.00607
0.00615
0.00623
0.00631
0.00636
0.00645
0.00657
0.00666
0.00673
0.00682
0.00688
0.00695
0.00704
0.00713
0.00722
0.00732
0.00741
0.00750
0.00758
0.00768
0.00777
0.00783
0.00788
0.00792
0.00795
0.00799
0.00803
0.00806
0.00807
0.00804
0.00800
0.00795
0.00787
0.00779
0.00767
0.00753
0.00737
0.00719
0.00699
0.00677
0.00652
0.00626
0.00599
0.00572
0.00546
0.00519
0.00492
0.00465
0.00437
0.00413
0.00391
and x_2 = 1700.42 1700.9 1701.38 1701.86 1702.34 1702.83 1703.31 1703.79 1704.27 1704.75 1705.24 1705.72 1706.2 1706.68 1707.17 1707.65 1708.13 1708.61 1709.09 1709.58 1710.06 1710.54 1711.02 1711.5 1711.99 1712.47 1712.95 1713.43 1713.91 1714.4 1714.88 1715.36 1715.84 1716.33 1716.81 1717.29 1717.77 1718.25 1718.74 1719.22 1719.7 1720.18 1720.66 1721.15 1721.63 1722.11 1722.59 1723.08 1723.56 1724.04 1724.52 1725 1725.49 1725.97 1726.45 1726.93 1727.41 1727.9 1728.38 1728.86 1729.34 1729.82 1730.31 1730.79 1731.27 1731.75 1732.24 1732.72 1733.2 1733.68 1734.16 1734.65 1735.13 1735.61 1736.09 1736.57 1737.06 1737.54 1738.02 1738.5 1738.98 1739.47 1739.95 1740.43 1740.91 1741.4 1741.88 1742.36 1742.84 1743.32 1743.81 1744.29 1744.77 1745.25 1745.73 1746.22 1746.7 1747.18 1747.66 1748.14 1748.63 1749.11 1749.59 1750.07 1750.56
y_2 = 0.00182478
0.00198449
0.0021542
0.00230491
0.00248363
0.00269334
0.00289705
0.00308676
0.00330747
0.00358919
0.0038779
0.00415561
0.00444332
0.00474103
0.00507474
0.00542346
0.00576517
0.00613688
0.00651859
0.0068873
0.00727502
0.00767773
0.00808544
0.00851815
0.00894486
0.00935658
0.00979429
0.010245
0.0106727
0.0110844
0.0115191
0.0119878
0.0124556
0.0128823
0.013274
0.0137237
0.0142374
0.0147181
0.0151798
0.0156495
0.0160963
0.016534
0.0169657
0.0173574
0.0177211
0.0180818
0.0184125
0.0187012
0.0189339
0.0191077
0.0192454
0.0193291
0.0193638
0.0193495
0.0192672
0.0191119
0.0188696
0.0185614
0.0181941
0.0176948
0.0170465
0.0162762
0.0153449
0.0142406
0.0129863
0.0115801
0.0100468
0.00844248
0.00692419
0.0055719
0.00435861
0.00340132
0.00270704
0.00213775
0.00168046
0.00134117
0.00109188
9.16595E-4
7.80307E-4
6.65019E-4
5.62731E-4
4.75443E-4
4.42155E-4
4.49867E-4
4.29579E-4
3.9929E-4
3.83002E-4
3.51714E-4
3.38426E-4
3.40138E-4
3.2985E-4
3.27562E-4
3.24274E-4
3.06986E-4
2.92698E-4
3.0041E-4
3.12121E-4
2.84833E-4
2.47545E-4
2.41257E-4
2.34969E-4
2.27681E-4
2.47393E-4
2.60105E-4
2.25817E-4
My original data:
x_orig = 1700.42
1700.9
1701.38
1701.86
1702.34
1702.83
1703.31
1703.79
1704.27
1704.75
1705.24
1705.72
1706.2
1706.68
1707.17
1707.65
1708.13
1708.61
1709.09
1709.58
1710.06
1710.54
1711.02
1711.5
1711.99
1712.47
1712.95
1713.43
1713.91
1714.4
1714.88
1715.36
1715.84
1716.33
1716.81
1717.29
1717.77
1718.25
1718.74
1719.22
1719.7
1720.18
1720.66
1721.15
1721.63
1722.11
1722.59
1723.08
1723.56
1724.04
1724.52
1725
1725.49
1725.97
1726.45
1726.93
1727.41
1727.9
1728.38
1728.86
1729.34
1729.82
1730.31
1730.79
1731.27
1731.75
1732.24
1732.72
1733.2
1733.68
1734.16
1734.65
1735.13
1735.61
1736.09
1736.57
1737.06
1737.54
1738.02
1738.5
1738.98
1739.47
1739.95
1740.43
1740.91
1741.4
1741.88
1742.36
1742.84
1743.32
1743.81
1744.29
1744.77
1745.25
1745.73
1746.22
1746.7
1747.18
1747.66
1748.14
1748.63
1749.11
1749.59
1750.07
1750.56
y_orig = 0.011507
0.0121121
0.0127542
0.0132673
0.0137554
0.0143684
0.0148995
0.0154036
0.0159997
0.0165907
0.0172408
0.0178499
0.018388
0.019089
0.0197701
0.0203572
0.0210393
0.0216564
0.0222324
0.0228305
0.0233166
0.0238667
0.0244387
0.0248918
0.0254159
0.025865
0.026158
0.0265131
0.0267652
0.0269333
0.0271824
0.0273214
0.0274515
0.0274626
0.0271257
0.0269957
0.0270148
0.0267899
0.026651
0.026427
0.0260381
0.0257212
0.0252253
0.0247254
0.0243314
0.0237925
0.0233076
0.0227997
0.0221607
0.0216288
0.0210079
0.020299
0.019702
0.0189881
0.0182382
0.0175053
0.0165944
0.0157524
0.0149355
0.0139746
0.0131167
0.0122307
0.0112948
0.0105009
0.00964397
0.00886105
0.00821613
0.0074542
0.00685928
0.00640136
0.00589444
0.00568351
0.00555559
0.00529467
0.00514074
0.00495682
0.0047789
0.00469697
0.00453005
0.00441613
0.0042912
0.00408328
0.00409536
0.00412444
0.00400951
0.00397959
0.00389367
0.00375074
0.00372082
0.0036819
0.00365497
0.00363905
0.00353413
0.00348721
0.00346528
0.00336936
0.00334044
0.00331251
0.00322459
0.00316767
0.00308874
0.00304882
0.0030859
0.00301798
0.00287005
How do I fit the two spectra to the original spectrum by extracting the coefficients from a least-squares linear fit? I use scipy.optimize.curve_fit to fit using gaussians, but now I need to just fit data.
When I scatterplot the data, it looks like three separate, somewhat asymmetrical peaks - I would think this requires one peak fit for each set of data. Please see my image and code below.
import numpy, matplotlib
import matplotlib.pyplot as plt
x_1 = numpy.array([1700.42, 1700.9, 1701.38, 1701.86, 1702.34, 1702.83, 1703.31, 1703.79, 1704.27, 1704.75, 1705.24, 1705.72, 1706.2, 1706.68, 1707.17, 1707.65, 1708.13, 1708.61, 1709.09, 1709.58, 1710.06, 1710.54, 1711.02, 1711.5, 1711.99, 1712.47, 1712.95, 1713.43, 1713.91, 1714.4, 1714.88, 1715.36, 1715.84, 1716.33, 1716.81, 1717.29, 1717.77, 1718.25, 1718.74, 1719.22, 1719.7, 1720.18, 1720.66, 1721.15, 1721.63, 1722.11, 1722.59, 1723.08, 1723.56, 1724.04, 1724.52, 1725, 1725.49, 1725.97, 1726.45, 1726.93, 1727.41, 1727.9, 1728.38, 1728.86, 1729.34, 1729.82, 1730.31, 1730.79, 1731.27, 1731.75, 1732.24, 1732.72, 1733.2, 1733.68, 1734.16, 1734.65, 1735.13, 1735.61, 1736.09, 1736.57, 1737.06, 1737.54, 1738.02, 1738.5, 1738.98, 1739.47, 1739.95, 1740.43, 1740.91, 1741.4, 1741.88, 1742.36, 1742.84, 1743.32, 1743.81, 1744.29, 1744.77, 1745.25, 1745.73, 1746.22, 1746.7, 1747.18, 1747.66, 1748.14, 1748.63, 1749.11, 1749.59, 1750.07, 1750.56])
y_1 = numpy.array([0.00285, 0.00289, 0.00290, 0.00292, 0.00297, 0.00304, 0.00310, 0.00314, 0.00319, 0.00323, 0.00327, 0.00333, 0.00340, 0.00344, 0.00347, 0.00352, 0.00358, 0.00364, 0.00369, 0.00374, 0.00382, 0.00388, 0.00392, 0.00397, 0.00403, 0.00408, 0.00414, 0.00420, 0.00428, 0.00436, 0.00444, 0.00451, 0.00456, 0.00461, 0.00468, 0.00474, 0.00480, 0.00486, 0.00493, 0.00501, 0.00509, 0.00517, 0.00524, 0.00530, 0.00535, 0.00543, 0.00551, 0.00558, 0.00564, 0.00571, 0.00578, 0.00587, 0.00594, 0.00599, 0.00607, 0.00615, 0.00623, 0.00631, 0.00636, 0.00645, 0.00657, 0.00666, 0.00673, 0.00682, 0.00688, 0.00695, 0.00704, 0.00713, 0.00722, 0.00732, 0.00741, 0.00750, 0.00758, 0.00768, 0.00777, 0.00783, 0.00788, 0.00792, 0.00795, 0.00799, 0.00803, 0.00806, 0.00807, 0.00804, 0.00800, 0.00795, 0.00787, 0.00779, 0.00767, 0.00753, 0.00737, 0.00719, 0.00699, 0.00677, 0.00652, 0.00626, 0.00599, 0.00572, 0.00546, 0.00519, 0.00492, 0.00465, 0.00437, 0.00413, 0.00391])
x_2 = numpy.array([1700.42, 1700.9, 1701.38, 1701.86, 1702.34, 1702.83, 1703.31, 1703.79, 1704.27, 1704.75, 1705.24, 1705.72, 1706.2, 1706.68, 1707.17, 1707.65, 1708.13, 1708.61, 1709.09, 1709.58, 1710.06, 1710.54, 1711.02, 1711.5, 1711.99, 1712.47, 1712.95, 1713.43, 1713.91, 1714.4, 1714.88, 1715.36, 1715.84, 1716.33, 1716.81, 1717.29, 1717.77, 1718.25, 1718.74, 1719.22, 1719.7, 1720.18, 1720.66, 1721.15, 1721.63, 1722.11, 1722.59, 1723.08, 1723.56, 1724.04, 1724.52, 1725, 1725.49, 1725.97, 1726.45, 1726.93, 1727.41, 1727.9, 1728.38, 1728.86, 1729.34, 1729.82, 1730.31, 1730.79, 1731.27, 1731.75, 1732.24, 1732.72, 1733.2, 1733.68, 1734.16, 1734.65, 1735.13, 1735.61, 1736.09, 1736.57, 1737.06, 1737.54, 1738.02, 1738.5, 1738.98, 1739.47, 1739.95, 1740.43, 1740.91, 1741.4, 1741.88, 1742.36, 1742.84, 1743.32, 1743.81, 1744.29, 1744.77, 1745.25, 1745.73, 1746.22, 1746.7, 1747.18, 1747.66, 1748.14, 1748.63, 1749.11, 1749.59, 1750.07, 1750.56])
y_2 = numpy.array([0.00182478, 0.00198449, 0.0021542, 0.00230491, 0.00248363, 0.00269334, 0.00289705, 0.00308676, 0.00330747, 0.00358919, 0.0038779, 0.00415561, 0.00444332, 0.00474103, 0.00507474, 0.00542346, 0.00576517, 0.00613688, 0.00651859, 0.0068873, 0.00727502, 0.00767773, 0.00808544, 0.00851815, 0.00894486, 0.00935658, 0.00979429, 0.010245, 0.0106727, 0.0110844, 0.0115191, 0.0119878, 0.0124556, 0.0128823, 0.013274, 0.0137237, 0.0142374, 0.0147181, 0.0151798, 0.0156495, 0.0160963, 0.016534, 0.0169657, 0.0173574, 0.0177211, 0.0180818, 0.0184125, 0.0187012, 0.0189339, 0.0191077, 0.0192454, 0.0193291, 0.0193638, 0.0193495, 0.0192672, 0.0191119, 0.0188696, 0.0185614, 0.0181941, 0.0176948, 0.0170465, 0.0162762, 0.0153449, 0.0142406, 0.0129863, 0.0115801, 0.0100468, 0.00844248, 0.00692419, 0.0055719, 0.00435861, 0.00340132, 0.00270704, 0.00213775, 0.00168046, 0.00134117, 0.00109188, 9.16595E-4, 7.80307E-4, 6.65019E-4, 5.62731E-4, 4.75443E-4, 4.42155E-4, 4.49867E-4, 4.29579E-4, 3.9929E-4, 3.83002E-4, 3.51714E-4, 3.38426E-4, 3.40138E-4, 3.2985E-4, 3.27562E-4, 3.24274E-4, 3.06986E-4, 2.92698E-4, 3.0041E-4, 3.12121E-4, 2.84833E-4, 2.47545E-4, 2.41257E-4, 2.34969E-4, 2.27681E-4, 2.47393E-4, 2.60105E-4, 2.25817E-4])
x_orig = numpy.array([1700.42, 1700.9, 1701.38, 1701.86, 1702.34, 1702.83, 1703.31, 1703.79, 1704.27, 1704.75, 1705.24, 1705.72, 1706.2, 1706.68, 1707.17, 1707.65, 1708.13, 1708.61, 1709.09, 1709.58, 1710.06, 1710.54, 1711.02, 1711.5, 1711.99, 1712.47, 1712.95, 1713.43, 1713.91, 1714.4, 1714.88, 1715.36, 1715.84, 1716.33, 1716.81, 1717.29, 1717.77, 1718.25, 1718.74, 1719.22, 1719.7, 1720.18, 1720.66, 1721.15, 1721.63, 1722.11, 1722.59, 1723.08, 1723.56, 1724.04, 1724.52, 1725, 1725.49, 1725.97, 1726.45, 1726.93, 1727.41, 1727.9, 1728.38, 1728.86, 1729.34, 1729.82, 1730.31, 1730.79, 1731.27, 1731.75, 1732.24, 1732.72, 1733.2, 1733.68, 1734.16, 1734.65, 1735.13, 1735.61, 1736.09, 1736.57, 1737.06, 1737.54, 1738.02, 1738.5, 1738.98, 1739.47, 1739.95, 1740.43, 1740.91, 1741.4, 1741.88, 1742.36, 1742.84, 1743.32, 1743.81, 1744.29, 1744.77, 1745.25, 1745.73, 1746.22, 1746.7, 1747.18, 1747.66, 1748.14, 1748.63, 1749.11, 1749.59, 1750.07, 1750.56])
y_orig = numpy.array([0.011507, 0.0121121, 0.0127542, 0.0132673, 0.0137554, 0.0143684, 0.0148995, 0.0154036, 0.0159997, 0.0165907, 0.0172408, 0.0178499, 0.018388, 0.019089, 0.0197701, 0.0203572, 0.0210393, 0.0216564, 0.0222324, 0.0228305, 0.0233166, 0.0238667, 0.0244387, 0.0248918, 0.0254159, 0.025865, 0.026158, 0.0265131, 0.0267652, 0.0269333, 0.0271824, 0.0273214, 0.0274515, 0.0274626, 0.0271257, 0.0269957, 0.0270148, 0.0267899, 0.026651, 0.026427, 0.0260381, 0.0257212, 0.0252253, 0.0247254, 0.0243314, 0.0237925, 0.0233076, 0.0227997, 0.0221607, 0.0216288, 0.0210079, 0.020299, 0.019702, 0.0189881, 0.0182382, 0.0175053, 0.0165944, 0.0157524, 0.0149355, 0.0139746, 0.0131167, 0.0122307, 0.0112948, 0.0105009, 0.00964397, 0.00886105, 0.00821613, 0.0074542, 0.00685928, 0.00640136, 0.00589444, 0.00568351, 0.00555559, 0.00529467, 0.00514074, 0.00495682, 0.0047789, 0.00469697, 0.00453005, 0.00441613, 0.0042912, 0.00408328, 0.00409536, 0.00412444, 0.00400951, 0.00397959, 0.00389367, 0.00375074, 0.00372082, 0.0036819, 0.00365497, 0.00363905, 0.00353413, 0.00348721, 0.00346528, 0.00336936, 0.00334044, 0.00331251, 0.00322459, 0.00316767, 0.00308874, 0.00304882, 0.0030859, 0.00301798, 0.00287005])
plt.plot(x_1, y_1, 'o')
plt.plot(x_2, y_2, 'o')
plt.plot(x_orig, y_orig, 'o')
plt.xlabel('X Data') # X axis data label
plt.ylabel('Y Data') # Y axis data label
plt.show()

Resources