Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
adapt examples
  • Loading branch information
internaut committed Jan 28, 2021
1 parent caf214f commit d8c29ca
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 68 deletions.
Binary file modified examples/duplicate_points.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/duplicate_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
distinct_pt_coords = coords[np.asarray(list(count_per_pt.keys()))]

# highlight voronoi regions with point duplicates
vor_colors = {i_poly: 'red' if len(pt_indices) > 1 else 'blue'
vor_colors = {i_poly: (1,0,0) if len(pt_indices) > 1 else (0,0,1)
for i_poly, pt_indices in poly_to_pt_assignments.items()}

fig, ax = subplot_for_map()
Expand All @@ -108,7 +108,7 @@
plot_voronoi_opts={'alpha': 0.2},
plot_points_opts={'alpha': 0.4},
voronoi_color=vor_colors,
voronoi_edgecolor='black',
voronoi_edgecolor=(0,0,0,1),
point_labels=pt_labels,
points_markersize=np.square(np.array(list(count_per_pt.values())))*10)

Expand Down
Binary file modified examples/random_points_across_italy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions examples/random_points_across_italy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
from geovoronoi import coords_to_points, voronoi_regions_from_coords
from geovoronoi.plotting import subplot_for_map, plot_voronoi_polys_with_points_in_area

import traceback
import warnings
import sys

def warn_with_traceback(message, category, filename, lineno, file=None, line=None):

log = file if hasattr(file,'write') else sys.stderr
traceback.print_stack(file=log)
log.write(warnings.formatwarning(message, category, filename, lineno, line))

warnings.showwarning = warn_with_traceback

logging.basicConfig(level=logging.INFO)
geovoronoi_log = logging.getLogger('geovoronoi')
Expand Down
Binary file modified examples/random_points_and_area.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/using_geopandas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion geovoronoi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@


__title__ = 'geovoronoi'
__version__ = '0.2.0'
__version__ = '0.3.0dev'
__author__ = 'Markus Konrad'
__license__ = 'Apache License 2.0'
8 changes: 4 additions & 4 deletions geovoronoi/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def colors_for_voronoi_polys_and_points(poly_shapes, poly_to_pt_assignments, poi

pt_to_poly = sorted(pt_to_poly.items(), key=lambda x: x[0])

pt_colors = ['black' if i_vor is None else vor_colors[i_vor] for _, i_vor in pt_to_poly]
pt_colors = [(0,0,0,1) if i_vor is None else vor_colors[i_vor] for _, i_vor in pt_to_poly]

assert len(vor_colors) <= len(pt_colors)

Expand Down Expand Up @@ -154,7 +154,7 @@ def plot_polygon(ax, polygon, facecolor=None, edgecolor=None, linewidth=1, lines


def plot_voronoi_polys_with_points_in_area(ax, area_shape, poly_shapes, points, poly_to_pt_assignments=None,
area_color='white', area_edgecolor='black',
area_color=(1,1,1,1), area_edgecolor=(0,0,0,1),
voronoi_and_points_cmap='tab20',
voronoi_color=None, voronoi_edgecolor=None,
points_color=None, points_markersize=5, points_marker='o',
Expand Down Expand Up @@ -185,7 +185,7 @@ def plot_voronoi_polys_with_points_in_area(ax, area_shape, poly_shapes, points,
cmap_name=voronoi_and_points_cmap)

if voronoi_color is None and voronoi_edgecolor is None:
voronoi_edgecolor = 'black' # better visible default value
voronoi_edgecolor = (0,0,0,1) # better visible default value

plot_voronoi_polys(ax, poly_shapes, color=voronoi_color, edgecolor=voronoi_edgecolor,
labels=voronoi_labels, label_fontsize=voronoi_label_fontsize, label_color=voronoi_label_color,
Expand All @@ -206,7 +206,7 @@ def _color_for_labels(label_color, default_color, seq_index):
else:
c = label_color

return c or 'black'
return c or (0,0,0,1)


def _plot_polygon_collection_with_color(ax, geoms, color=None, **kwargs):
Expand Down
58 changes: 6 additions & 52 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,52 +1,6 @@
appdirs==1.4.3
attrs==19.3.0
backcall==0.1.0
Click==7.0
click-plugins==1.1.1
cligj==0.5.0
cycler==0.10.0
decorator==4.4.2
descartes==1.1.0
distlib==0.3.0
filelock==3.0.12
Fiona==1.8.13.post1
geopandas==0.7.0
hypothesis==5.6.0
importlib-metadata==1.5.0
importlib-resources==1.2.0
ipython==7.13.0
ipython-genutils==0.2.0
jedi==0.16.0
kiwisolver==1.1.0
matplotlib==3.2.0
more-itertools==8.2.0
munch==2.5.0
nose==1.3.7
numpy==1.18.1
packaging==20.3
pandas==1.0.1
parso==0.6.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==7.0.0
pluggy==0.13.1
prompt-toolkit==3.0.3
ptyprocess==0.6.0
py==1.8.1
Pygments==2.5.2
pyparsing==2.4.6
pyproj==2.5.0
pytest==5.3.5
pytest-mpl==0.11
python-dateutil==2.8.1
pytz==2019.3
scipy==1.4.1
Shapely==1.7.0
six==1.14.0
sortedcontainers==2.1.0
toml==0.10.0
tox==3.14.5
traitlets==4.3.3
virtualenv==20.0.8
wcwidth==0.1.8
zipp==3.1.0
# requirements.txt
#
# installs dependencies from ./setup.py, and the package itself,
# in editable mode for development

-e .[all]
27 changes: 18 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,25 @@
GITHUB_URL = 'https://github.com/WZBSocialScienceCenter/geovoronoi'

__title__ = 'geovoronoi'
__version__ = '0.2.0'
__version__ = '0.3.0dev'
__author__ = 'Markus Konrad'
__license__ = 'Apache License 2.0'

here = os.path.abspath(os.path.dirname(__file__))

DEPS_BASE = ['numpy>=1.19.0,<2', 'scipy>=1.6.0,<1.7', 'shapely>=1.7.0,<1.8']

DEPS_EXTRA = {
'plotting': ['matplotlib>=3.3.0,<3.4', 'geopandas>=0.8.0,<0.9', 'descartes>=1.1.0,<1.2'],
'test': ['pytest>=6.2.0,<6.3', 'pytest-mpl>=0.12,<0.13', 'hypothesis>=6.0.0,<6.1', 'tox>=3.21.0,<3.22'],
'develop': ['ipython>=7.19.0', 'twine>=3.3.0'],
}

DEPS_EXTRA['all'] = []
for k, deps in DEPS_EXTRA.items():
if k != 'all':
DEPS_EXTRA['all'].extend(deps)

# Get the long description from the README file
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
Expand Down Expand Up @@ -43,10 +56,10 @@
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',

'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Software Development :: Libraries :: Python Modules',
Expand All @@ -58,10 +71,6 @@
packages=['geovoronoi'],
# include_package_data=True,
python_requires='>=3.6',
install_requires=['numpy>=1.18.0', 'scipy>=1.4.0', 'shapely>=1.7.0'],
extras_require={
'plotting': ['matplotlib>=3.2.0', 'geopandas>=0.7.0', 'descartes>=1.1.0'],
'test': ['pytest>=5.3.0', 'pytest-mpl>=0.11', 'hypothesis>=5.6.0', 'tox>=3.14.0'],
'develop': ['ipython>=7.0.0', 'twine>=3.1.0'],
}
install_requires=DEPS_BASE,
extras_require=DEPS_EXTRA
)

0 comments on commit d8c29ca

Please sign in to comment.