如何保存一个形状的对象作为图像

问题描述 投票:0回答:1

我在python中有一个整体的对象。这是美国地图的轮廓。 如何将其保存为EPS或PDF?

python shapely
1个回答
0
投票
我有一个多角对象:

import matplotlib.pyplot as plt from shapely.plotting import plot_polygon print(type(multipolygon)) #<class 'shapely.geometry.multipolygon.MultiPolygon'> fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(8,5)) plot_polygon(polygon=multipolygon, ax=ax, add_points=False, color="green") fig.savefig(r"C:\Users\bera\Desktop\gistest\usa.pdf", bbox_inches='tight')
pdf:

enter image description here

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.