pythonjupyter-labhvplot

Prevent plot generating a line from end to end?


I am trying to plot a set of data with HVPlots that is basically 2 distinct sets of data, which have overlapping but not similar X-axis values. For example, one set of data might have x values that the other set does not. My problem is that one data set will generate a giant line from the lowest available data value to the largest available data value, which is not desirable.

enter image description here

Is there a way to prevent this giant line from forming? The data comes from a Pandas data frame. Thank you in advance.

Here is the CSV data, sorry for large text blob.

Sensor,Wavelength,Reflectance
ASD Spectroradiometer,351,2.366017680952381
ASD Spectroradiometer,361,2.331935738095238
ASD Spectroradiometer,371,2.411581838095238
ASD Spectroradiometer,381,2.532860261904762
ASD Spectroradiometer,391,2.7003822619047617
ASD Spectroradiometer,401,2.9276017000000003
ASD Spectroradiometer,411,3.2230437285714286
ASD Spectroradiometer,421,3.5098273809523812
ASD Spectroradiometer,431,3.771806080952381
ASD Spectroradiometer,441,4.01568979047619
ASD Spectroradiometer,451,4.2303226
ASD Spectroradiometer,461,4.368147842857143
ASD Spectroradiometer,471,4.475379871428571
ASD Spectroradiometer,481,4.619372876190476
ASD Spectroradiometer,491,4.934205747619048
ASD Spectroradiometer,501,5.5589851476190475
ASD Spectroradiometer,511,6.611812633333334
ASD Spectroradiometer,521,7.658471504761904
ASD Spectroradiometer,531,8.871451647619049
ASD Spectroradiometer,541,9.612126333333332
ASD Spectroradiometer,551,9.812289047619048
ASD Spectroradiometer,561,9.78037688095238
ASD Spectroradiometer,571,9.215086180952381
ASD Spectroradiometer,581,8.797968795238095
ASD Spectroradiometer,591,8.592741176190476
ASD Spectroradiometer,601,8.864050938095238
ASD Spectroradiometer,611,8.547237004761906
ASD Spectroradiometer,621,8.38708988095238
ASD Spectroradiometer,631,8.297810661904762
ASD Spectroradiometer,641,7.898150842857143
ASD Spectroradiometer,651,7.490158095238095
ASD Spectroradiometer,661,6.934392276190476
ASD Spectroradiometer,671,6.718084728571428
ASD Spectroradiometer,681,7.488319004761905
ASD Spectroradiometer,691,10.076167985714287
ASD Spectroradiometer,701,13.903101442857142
ASD Spectroradiometer,711,18.043517014285715
ASD Spectroradiometer,721,22.599126995238095
ASD Spectroradiometer,731,26.585296019047615
ASD Spectroradiometer,741,29.842715928571426
ASD Spectroradiometer,751,31.670012295238095
ASD Spectroradiometer,761,32.65358429047619
ASD Spectroradiometer,771,33.0214157
ASD Spectroradiometer,781,33.2225933
ASD Spectroradiometer,791,33.971715119047616
ASD Spectroradiometer,801,34.088703452380955
ASD Spectroradiometer,811,33.98315268095238
ASD Spectroradiometer,821,33.9851173047619
ASD Spectroradiometer,831,33.922463685714284
ASD Spectroradiometer,841,33.84191823333333
ASD Spectroradiometer,851,33.762833557142855
ASD Spectroradiometer,861,34.45042144761904
ASD Spectroradiometer,871,34.3900826047619
ASD Spectroradiometer,881,33.992278276190476
ASD Spectroradiometer,891,34.4196046047619
ASD Spectroradiometer,901,34.08971545714286
ASD Spectroradiometer,911,33.274154847619045
ASD Spectroradiometer,921,34.60354207142857
ASD Spectroradiometer,931,31.59504019
ASD Spectroradiometer,941,30.857523935
ASD Spectroradiometer,951,29.958660244999997
ASD Spectroradiometer,961,29.332447275
ASD Spectroradiometer,971,31.457758314285716
ASD Spectroradiometer,981,30.253198885714287
ASD Spectroradiometer,991,30.40822853809524
ASD Spectroradiometer,1001,30.82452592857143
ASD Spectroradiometer,1011,31.283128052380953
ASD Spectroradiometer,1021,31.696303133333334
ASD Spectroradiometer,1031,32.123036623809526
ASD Spectroradiometer,1041,32.45516933333333
ASD Spectroradiometer,1051,32.70891486190476
ASD Spectroradiometer,1061,32.82660850476191
ASD Spectroradiometer,1071,32.81074540952381
ASD Spectroradiometer,1081,32.67240297142857
ASD Spectroradiometer,1091,32.45174736190476
ASD Spectroradiometer,1101,32.35924216666667
ASD Spectroradiometer,1111,32.193539052380956
ASD Spectroradiometer,1121,31.186914390476193
ASD Spectroradiometer,1131,29.353473933333333
ASD Spectroradiometer,1141,27.60724942380952
ASD Spectroradiometer,1151,26.61407247619048
ASD Spectroradiometer,1161,26.204433766666668
ASD Spectroradiometer,1171,26.01462468571429
ASD Spectroradiometer,1181,25.932588980952378
ASD Spectroradiometer,1191,25.878199852380952
ASD Spectroradiometer,1201,25.971946195238097
ASD Spectroradiometer,1211,26.1467703
ASD Spectroradiometer,1221,26.390612085714285
ASD Spectroradiometer,1231,26.62084949047619
ASD Spectroradiometer,1241,26.81470090952381
ASD Spectroradiometer,1251,26.954826490476187
ASD Spectroradiometer,1261,27.005410966666666
ASD Spectroradiometer,1271,26.938313342857143
ASD Spectroradiometer,1281,26.70899681904762
ASD Spectroradiometer,1291,26.346566161904764
ASD Spectroradiometer,1301,25.7960428
ASD Spectroradiometer,1311,25.039130142857143
ASD Spectroradiometer,1321,24.194845576190477
ASD Spectroradiometer,1331,23.294422766666667
ASD Spectroradiometer,1341,22.862145180952382
ASD Spectroradiometer,1351,25.349347795238096
ASD Spectroradiometer,1361,48.14024703846154
ASD Spectroradiometer,1371,59.07994106666667
ASD Spectroradiometer,1381,42.16908668333333
ASD Spectroradiometer,1391,44.555739205882354
ASD Spectroradiometer,1401,25.44392773157895
ASD Spectroradiometer,1411,15.754125947619048
ASD Spectroradiometer,1421,9.13630871
ASD Spectroradiometer,1431,8.127483085
ASD Spectroradiometer,1441,7.62274687
ASD Spectroradiometer,1451,10.286426052380952
ASD Spectroradiometer,1461,10.971339814285713
ASD Spectroradiometer,1471,8.27525826
ASD Spectroradiometer,1481,10.681376876190475
ASD Spectroradiometer,1491,11.48638419047619
ASD Spectroradiometer,1501,11.800823661904762
ASD Spectroradiometer,1511,12.06884128095238
ASD Spectroradiometer,1521,12.65723262857143
ASD Spectroradiometer,1531,13.097973904761906
ASD Spectroradiometer,1541,13.605298185714286
ASD Spectroradiometer,1551,14.072914347619049
ASD Spectroradiometer,1561,14.53819999047619
ASD Spectroradiometer,1571,14.91622150952381
ASD Spectroradiometer,1581,15.385452152380951
ASD Spectroradiometer,1591,15.754460019047619
ASD Spectroradiometer,1601,16.051853242857142
ASD Spectroradiometer,1611,16.41691283333333
ASD Spectroradiometer,1621,16.715609385714284
ASD Spectroradiometer,1631,16.957716828571428
ASD Spectroradiometer,1641,17.177434495238096
ASD Spectroradiometer,1651,17.28744548095238
ASD Spectroradiometer,1661,17.31632067142857
ASD Spectroradiometer,1671,17.46885692857143
ASD Spectroradiometer,1681,17.417731695238096
ASD Spectroradiometer,1691,17.25681396190476
ASD Spectroradiometer,1701,16.97000082857143
ASD Spectroradiometer,1711,16.9938082
ASD Spectroradiometer,1721,16.738854423809524
ASD Spectroradiometer,1731,16.495409976190476
ASD Spectroradiometer,1741,16.234662033333333
ASD Spectroradiometer,1751,15.839467495238095
ASD Spectroradiometer,1761,15.786847485714285
ASD Spectroradiometer,1771,16.25627149047619
ASD Spectroradiometer,1781,16.97806518095238
ASD Spectroradiometer,1791,17.908546161904763
ASD Spectroradiometer,1801,23.388141647619047
ASD Spectroradiometer,1811,43.47561029047619
ASD Spectroradiometer,1821,52.18485304666667
ASD Spectroradiometer,1831,73.7201144
ASD Spectroradiometer,1841,60.6028599
ASD Spectroradiometer,1851,60.116216425000005
ASD Spectroradiometer,1861,71.42023818333332
ASD Spectroradiometer,1871,78.26034791666667
ASD Spectroradiometer,1881,45.4537712
ASD Spectroradiometer,1891,63.046238844444446
ASD Spectroradiometer,1901,62.38818035714286
ASD Spectroradiometer,1911,66.42941403636364
ASD Spectroradiometer,1921,41.76184813846154
ASD Spectroradiometer,1931,24.235577478947366
ASD Spectroradiometer,1941,15.124355349999998
ASD Spectroradiometer,1951,7.906090740000001
ASD Spectroradiometer,1961,5.131224065
ASD Spectroradiometer,1971,4.675396409999999
ASD Spectroradiometer,1981,6.959055166666666
ASD Spectroradiometer,1991,5.033356415
ASD Spectroradiometer,2001,5.57380403
ASD Spectroradiometer,2011,9.325861314285714
ASD Spectroradiometer,2021,5.850390105000001
ASD Spectroradiometer,2031,9.031549395238095
ASD Spectroradiometer,2041,8.531987861904762
ASD Spectroradiometer,2051,6.206570775
ASD Spectroradiometer,2061,6.589260059999999
ASD Spectroradiometer,2071,10.372672114285715
ASD Spectroradiometer,2081,10.726741795238095
ASD Spectroradiometer,2091,10.521891738095238
ASD Spectroradiometer,2101,10.669014566666666
ASD Spectroradiometer,2111,9.852652914285713
ASD Spectroradiometer,2121,10.772544114285713
ASD Spectroradiometer,2131,11.289981757142856
ASD Spectroradiometer,2141,11.026715971428573
ASD Spectroradiometer,2151,10.544981942857143
ASD Spectroradiometer,2161,11.36658129047619
ASD Spectroradiometer,2171,11.474233223809524
ASD Spectroradiometer,2181,11.369702157142857
ASD Spectroradiometer,2191,11.202190814285714
ASD Spectroradiometer,2201,11.413553723809523
ASD Spectroradiometer,2211,12.1588531
ASD Spectroradiometer,2221,11.347909323809525
ASD Spectroradiometer,2231,11.005719833333334
ASD Spectroradiometer,2241,11.95162927142857
ASD Spectroradiometer,2251,13.016460580952382
ASD Spectroradiometer,2261,11.359875595238096
ASD Spectroradiometer,2271,10.323916352380953
ASD Spectroradiometer,2281,11.045970476190476
ASD Spectroradiometer,2291,12.301717466666668
ASD Spectroradiometer,2301,8.442657344999999
ASD Spectroradiometer,2311,11.372022133333333
ASD Spectroradiometer,2321,8.158667325
ASD Spectroradiometer,2331,12.363157214285716
ASD Spectroradiometer,2341,9.58487475
ASD Spectroradiometer,2351,13.746765571428572
ASD Spectroradiometer,2361,11.19604978
ASD Spectroradiometer,2371,15.484635604761904
ASD Spectroradiometer,2381,18.45235744761905
ASD Spectroradiometer,2391,17.552425945000003
ASD Spectroradiometer,2401,21.62124119047619
ASD Spectroradiometer,2411,24.517993784210525
ASD Spectroradiometer,2421,26.996395569999997
ASD Spectroradiometer,2431,37.142717276190474
ASD Spectroradiometer,2441,41.40074152777778
ASD Spectroradiometer,2451,49.020428564285716
ASD Spectroradiometer,2461,56.00733290588236
ASD Spectroradiometer,2471,57.91808042
ASD Spectroradiometer,2481,61.93589225
ASD Spectroradiometer,2491,64.30513181
Hyperion,437,19.64157831258621
Hyperion,447,17.635061447931033
Hyperion,457,16.449246691551725
Hyperion,468,16.15705898474138
Hyperion,478,15.74820502637931
Hyperion,488,15.312393331465518
Hyperion,498,14.873019265258622
Hyperion,508,14.717076484568965
Hyperion,518,15.050325962672414
Hyperion,529,15.54409327077586
Hyperion,539,16.30896251051724
Hyperion,549,16.743916524655173
Hyperion,559,16.44097681836207
Hyperion,569,15.3861652975
Hyperion,579,14.405870403155173
Hyperion,590,13.446363262870689
Hyperion,600,12.940704195801723
Hyperion,610,12.092371508991379
Hyperion,620,11.485950834870689
Hyperion,630,10.86219115910345
Hyperion,641,10.415480080043103
Hyperion,651,9.783529566698276
Hyperion,661,9.192405445905173
Hyperion,671,8.605658096724138
Hyperion,681,8.511903648043104
Hyperion,691,9.501815567327586
Hyperion,702,13.25404950224138
Hyperion,712,18.523986039293103
Hyperion,722,27.281047386379313
Hyperion,732,36.48630899293103
Hyperion,742,45.45041980008621
Hyperion,752,51.001896649827586
Hyperion,763,54.23825855189655
Hyperion,773,57.10729264068966
Hyperion,783,58.97245245431034
Hyperion,793,60.00227961137931
Hyperion,803,58.66465964336207
Hyperion,813,56.94799882844828
Hyperion,824,56.282548226465515
Hyperion,834,57.849257758534485
Hyperion,844,60.465879663879306
Hyperion,854,62.46956642577586
Hyperion,864,63.924008373103455
Hyperion,875,63.878416097758624
Hyperion,885,62.87269146534483
Hyperion,895,58.10655755439655
Hyperion,905,57.764221588103446
Hyperion,912,55.40129814172414
Hyperion,915,55.650250770431036
Hyperion,923,52.27564720525862
Hyperion,983,43.52169382801724
Hyperion,993,46.02803250439655
Hyperion,1003,47.62955228603449
Hyperion,1013,49.369881755172415
Hyperion,1023,51.160603453879304
Hyperion,1033,52.81318591112069
Hyperion,1044,54.10608127612069
Hyperion,1054,55.16663492577587
Hyperion,1064,55.48003160017242
Hyperion,1074,55.825980545862066
Hyperion,1084,53.86836560827586
Hyperion,1094,50.713034232758616
Hyperion,1175,38.119737971724135
Hyperion,1185,38.139289961637935
Hyperion,1195,38.81876481224138
Hyperion,1205,39.4530816137931
Hyperion,1215,40.79529787836207
Hyperion,1225,42.18789575336207
Hyperion,1235,42.21644175474138
Hyperion,1245,41.41844723741379
Hyperion,1255,39.09849059801724
Hyperion,1266,38.180224266982755
Hyperion,1276,38.742529224827585
Hyperion,1286,40.413628639827586
Hyperion,1296,38.65788865862069
Hyperion,1306,35.212444053620686
Hyperion,1316,30.05225485698276
Hyperion,1518,11.892145316025863
Hyperion,1528,13.087704254689655
Hyperion,1538,14.187574689086206
Hyperion,1548,15.276215815034483
Hyperion,1558,15.749542909956897
Hyperion,1568,16.10722296464655
Hyperion,1578,16.580839382672412
Hyperion,1588,17.264350392413792
Hyperion,1599,18.040146485603447
Hyperion,1609,18.899734538017242
Hyperion,1619,19.899311313275863
Hyperion,1629,20.43375038
Hyperion,1639,20.759769686810344
Hyperion,1649,20.914163323793105
Hyperion,1659,21.254143447672416
Hyperion,1669,21.191186860431035
Hyperion,1679,20.955151856034483
Hyperion,1689,20.473780314224136
Hyperion,1699,20.137747822413793
Hyperion,1710,19.639136076293106
Hyperion,1720,19.116003226293103
Hyperion,1730,18.394732977931035
Hyperion,1740,17.706794351982758
Hyperion,1750,16.767835573448277
Hyperion,1760,15.518027240612069
Hyperion,2063,3.9882675921652173
Hyperion,2073,5.022168462698276
Hyperion,2083,5.594791430353449
Hyperion,2093,6.269073005267241
Hyperion,2103,7.061218918025863
Hyperion,2113,7.329308762103448
Hyperion,2123,7.364271326344827
Hyperion,2133,7.768011612025862
Hyperion,2143,8.413078764543103
Hyperion,2153,8.356304989
Hyperion,2163,7.8771344906034475
Hyperion,2174,8.216717378482759
Hyperion,2184,8.869170033853448
Hyperion,2194,9.12920156661207
Hyperion,2204,8.834957132491379
Hyperion,2214,9.064205993275861
Hyperion,2224,9.42482331187931
Hyperion,2234,9.040256168396551
Hyperion,2244,8.102291135474138
Hyperion,2254,7.392873260551725
Hyperion,2264,7.207006276551724
Hyperion,2274,7.077930408775862
Hyperion,2285,6.661956199137931
Hyperion,2295,6.4357267450172415
Hyperion,2305,6.1514400319137925
Hyperion,2315,6.068238294706896
Hyperion,2325,5.590846560155172
Hyperion,2335,5.12296235687069
Hyperion,2345,4.748333256173913

Solution

  • That line coming across is joining two different charts. The data contains 2 "Sensors" which have (technically) overlapping x axis values.

    what you need to do is filter out the data by Sensor, and plot them individually.

    data[data.Sensor.eq('Hyperion')] this will give you data filtered only for the "Hyperion" sensor.

    you can do the same for all unique sensors, and then plot them as individual trances on the same x and y axis to get a multi lined chart.