« first day (1837 days earlier)      last day (1519 days later) » 

11:04 PM
I'm absolutely stumped;
import geopandas as gpd
import matplotlib.pyplot as plt
import numpy as np
import math
import pandas as pd
import seaborn as sns
from scipy import *
from scipy.spatial import Voronoi, voronoi_plot_2d
cities = gpd.read_file('belgian_cities.shp')
g = [i for i in cities.geometry]
x,y = g[0].exterior.coords.xy
all_coords = np.dstack((x,y)) ####

for interior in g[0].interiors: # for first feature/row
x, y = interior.coords.xy
coords = np.dstack((x,y))
all_coords = np.append(all_coords, coords, axis=0)

vor = Voronoi(all_coords)
fig = voronoi_plot_2d(vor)
plt.show()
This simple python script doesn't work
Basically, I'm inputting a map, and feeding the vertices of said map into an array, on which I perform the Voronoi SciPy function. But then I get two errors.
If anyone can help me address the problem, that would be great
0
Q: Voronoi Diagram on Array of Vertices

DarkRunnerI'm trying to create a diagram of a sample map. I feed the x and y vertices of the map into an array, after which I perform a import matplotlib.pyplot as plt import numpy as np import math import pandas as pd import seaborn as sns from scipy import * from scipy.spatial import Voronoi, voronoi_pl...

 
11:30 PM
7 messages moved from Python
 

« first day (1837 days earlier)      last day (1519 days later) »