mirror of
https://github.com/marceloprates/prettymaps.git
synced 2025-08-13 18:14:27 +02:00
use shapely.geometry.box for polygon from bounds
This commit is contained in:
@@ -6,7 +6,7 @@ import pandas as pd
|
|||||||
from geopandas import GeoDataFrame
|
from geopandas import GeoDataFrame
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numpy.random import choice
|
from numpy.random import choice
|
||||||
from shapely.geometry import Polygon, MultiPolygon, MultiLineString, GeometryCollection
|
from shapely.geometry import box, Polygon, MultiLineString, GeometryCollection
|
||||||
from shapely.affinity import translate, scale, rotate
|
from shapely.affinity import translate, scale, rotate
|
||||||
from descartes import PolygonPatch
|
from descartes import PolygonPatch
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
@@ -202,13 +202,7 @@ def plot(
|
|||||||
|
|
||||||
# Plot background
|
# Plot background
|
||||||
if 'background' in drawing_kwargs:
|
if 'background' in drawing_kwargs:
|
||||||
xmin, ymin, xmax, ymax = layers['perimeter'].bounds
|
geom = scale(box(*layers['perimeter'].bounds), 2, 2)
|
||||||
geom = scale(Polygon([
|
|
||||||
(xmin, ymin),
|
|
||||||
(xmin, ymax),
|
|
||||||
(xmax, ymax),
|
|
||||||
(xmax, ymin)
|
|
||||||
]), 2, 2)
|
|
||||||
|
|
||||||
if vsketch is None:
|
if vsketch is None:
|
||||||
ax.add_patch(PolygonPatch(geom, **drawing_kwargs['background']))
|
ax.add_patch(PolygonPatch(geom, **drawing_kwargs['background']))
|
||||||
|
Reference in New Issue
Block a user