在制图中修改地图的边界/整齐线#

此示例演示如何修改轴的边界/整齐线。我们在Plate Carree坐标系中构建一颗具有坐标的恒星,并使用该恒星作为地图的轮廓。

请注意更改地图投影如何代表 projected 星形边界。

star shaped boundary
import matplotlib.path as mpath
import matplotlib.pyplot as plt

import cartopy.crs as ccrs


def main():
    fig = plt.figure()
    ax = fig.add_axes([0, 0, 1, 1], projection=ccrs.PlateCarree())
    ax.coastlines()

    # Construct a star in longitudes and latitudes.
    star_path = mpath.Path.unit_regular_star(5, 0.5)
    star_path = mpath.Path(star_path.vertices.copy() * 80,
                           star_path.codes.copy())

    # Use the star as the boundary.
    ax.set_boundary(star_path, transform=ccrs.PlateCarree())

    plt.show()


if __name__ == '__main__':
    main()

Total running time of the script: (0分0.032秒)

Gallery generated by Sphinx-Gallery _