Sunday, 22 September 2019

Individual nested lists visualization

I was trying to split the main question and get the answer, but it didn't work. So, asking the whole question.

I have a list of the list (or nested list):

list = 

[[      ordinal  id_easy  latitude  longitude
  1891        1    17840   45.1069     7.6450
  1892        2    17840   45.1069     7.6387
  1893        3    17840   45.1075     7.6291
  1894        4    17840   45.1121     7.6297,
      ordinal  id_easy  latitude  longitude
  3855      1    15192   45.0066     7.5420
  3856      2    15192   45.0076     7.5423
  3857      3    15192   45.0066     7.5409
  3858      4    15192   45.0067     7.5413,
      ordinal  id_easy  latitude  longitude
 1478        1     3487   45.0333     7.5596
 1479        2     3487   45.0374     7.5658
 1480        3     3487   45.0356     7.5761],
    [  ordinal  id_easy  latitude  longitude
  4143       1    26587   45.0363     7.6438
  4144       2    26587   45.0365     7.6431,
       ordinal  id_easy  latitude  longitude
  435        1    20047   45.0762     7.6594
  436        2    20047   45.0759     7.6517
  437        3    20047   45.0756     7.6437]

The length of this nested list is:

len(final_cluster_result) = 2     #2 clusters

If I check length of the first cluster:

final_cluster_result[0]) = 3     # 3 cars in cluster 1

And finally, final_cluster_result[0][0].longitude and .latitude gives us a series with locations of first cluster, first car.

Question:

With the help of for loop I want to:

  • plot all clusters geo data in a grey
  • plot on the previous one the highlighted geo data of first cluster, then another plot with second cluster
  • (!) While highlighting a cluster on grey plot, color every car in a different color (as we see in a column id_easy is a individual car).
  • after doing that I want to show the beginning point of every car (imagine that capital O is a starting point and other o are the rest [O o o o o])

Something like:

enter image description here

But there in red dots not one car, but 2-3 cars. I want to define them in a different color



from Individual nested lists visualization

No comments:

Post a Comment