As the title suggests, when using networkx, there are some problems with visualization. For example
--When the real value corresponds to the node → Change the size (s) of the node --When discrete values correspond to the node → Change the color of the node
It can be easily distinguished by the feeling, but it is often difficult to read the numerical values well only in two dimensions. Here, I used Axes3D of matplotlib and tried to visualize it by cutting corners as much as possible. As an example, take the latitude and longitude of the location of the prefectural office in Kanto, and consider that the population of each prefecture is on each point. I visualized it as follows.
2D | 3D |
---|---|
I took it properly (reference: https://www.benricho.org/chimei/latlng_data.html). I made the connection properly. I appologize if I am mistaken.
8,Ibaraki Prefecture,36.34139,140.44667,2868041
9,Tochigi Prefecture,36.56583,139.88361,1942312
10,Gunma Prefecture,36.39111,139.06083,1937626
11,Saitama,35.85694,139.64889,7337330
12,Chiba,35.60472,140.12333,6279026
13,Tokyo,35.68944,139.69167,13942856
14,Kanagawa Prefecture,35.44778,139.6425,9200166
8,9
8,11
8,12
9,8
9,10
9,12
10,9
10,11
11,8
11,9
11,10
11,12
11,13
13,12
13,14
14,13
I use Axes3D, but networkx drawing functions such as nx.draw get angry even if I pass Axes3D. Therefore, I decided to forcibly draw by inputting the data in the z-axis direction. In particular
--Set the point where the graph is drawn to $ z = 0 $ --Draw the number corresponding to the node on the $ z $ axis
It is said. The result obtained in this way is shown in the figure above.
https://github.com/cocomoff/PlotMapHeight
Recommended Posts