extended_graph_visualizer.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:vnep-approx 作者: vnep-approx 项目源码 文件源码
def _initialize_background_map(self):  # calculate the correct aspect ratio by drawing a map of the substrate
        fig = plt.figure()
        ax = plt.subplot(111)
        nodes_to_map_coordinates = [MapCoordinate(lat=data['Latitude'], lon=data['Longitude'])
                                    for n, data in self._substrate.node.items()]
        lower_left, upper_right = ExtendedGraphVisualizer._get_corner_map_coordinates(nodes_to_map_coordinates)
        self._background_map = Basemap(resolution="c",
                                       projection='merc',
                                       anchor="W",
                                       ax=ax,
                                       llcrnrlat=lower_left.lat,
                                       urcrnrlat=upper_right.lat,
                                       llcrnrlon=lower_left.lon,
                                       urcrnrlon=upper_right.lon,
                                       fix_aspect=True)
        self._background_map.fillcontinents(ax=ax)
        (xmin, xmax), (ymin, ymax) = ax.get_xlim(), ax.get_ylim()
        dx, dy = float(abs(xmax - xmin)), float(abs(ymax - ymin))
        self._map_width = (dx / dy) * MAP_HEIGHT
        plt.close(fig)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号