From dc6046fc68dae4bb781f91a1c88103586fe00713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 26 May 2020 17:08:35 +0300 Subject: [PATCH] more control over the plot --- II/Referatas/layer2img.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/II/Referatas/layer2img.py b/II/Referatas/layer2img.py index b536e07..61c498f 100755 --- a/II/Referatas/layer2img.py +++ b/II/Referatas/layer2img.py @@ -43,16 +43,16 @@ def main(): f = geopandas.read_postgis(sql, con=conn, geom_col='geom') else: f = geopandas.read_file(args.infile) - f.plot(figsize=args.size) - ax = plt.gca() + fig, ax = plt.subplots() + f.plot(ax=ax, figsize=args.size) if args.clip: ax.set_xlim(left=args.clip[0], right=args.clip[2]) ax.set_ylim(bottom=args.clip[1], top=args.clip[3]) ax.axis('off') ax.margins(0, 0) - plt.tight_layout(0) + fig.tight_layout(0) if args.outfile: - plt.savefig(args.outfile, bbox_inches=0, dpi=600) + fig.savefig(args.outfile, bbox_inches=0, dpi=600) else: plt.show()