From fcd1f70dccd3ce97d1d92e28c5a80226a8f4c9ca Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 3 Dec 2021 19:07:53 +0100 Subject: [PATCH 01/19] add new dependencies to setup.py --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7dbb1a8a3..607e92a7e 100644 --- a/setup.py +++ b/setup.py @@ -30,14 +30,19 @@ long_description_content_type="text/markdown", install_requires=[ "numpy", + "scipy", "pandas", - "geopandas", "matplotlib>=3.0", "cartopy>=0.20.0", "descartes", "mapclassify", "pyproj", "pyepsg", + "geopandas", + "owslib", + "requests", + "xmltodict", + "cairosvg", ], keywords=["visualization", "plotting", "maps", "geographical data"], # See https://pypi.python.org/pypi?%3Aaction=list_classifiers From 960b647ca0b36ba29f1fca2249507edafcc94915 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 3 Dec 2021 19:38:29 +0100 Subject: [PATCH 02/19] include LICENSE file in setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c647f435c..1e8b80247 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="EOmaps", version=version, - description="A library to generate interactive maps of geographical datasets.", + description="A library to create interactive maps of geographical datasets.", packages=find_packages(), package_dir={"eomaps": "eomaps"}, # include_package_data=True, @@ -54,4 +54,5 @@ # ~ 'License :: OSI Approved :: MIT License', "Programming Language :: Python :: 3.7", ], + license_files=("LICENSE",), ) From cdfaf4dcd600acae86b275d6b2d4c0e30b4a207c Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 3 Dec 2021 23:17:07 +0100 Subject: [PATCH 03/19] update doc --- docs/api.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 46e27f2a5..6432655bd 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -40,8 +40,7 @@ use: MapsGrid -If you want to create multiple maps-objects with similar properties, use: -(you can of course adjust the properties of the copied object afterwards!) +To get a copy of a `Maps`-object with the same specifications, use: .. code-block:: python @@ -49,7 +48,7 @@ If you want to create multiple maps-objects with similar properties, use: m = Maps() ... - m2 = m.copy() + m2 = m.copy(...) .. currentmodule:: eomaps From f8fcb32b8af0d372b75b080b22cb12e97a9f6650 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 6 Dec 2021 22:06:30 +0100 Subject: [PATCH 04/19] make MapsGrid a proper class - wrap docs from Maps to functions --- eomaps/eomaps.py | 194 ++++++++++++++++++++++++++--------------------- 1 file changed, 109 insertions(+), 85 deletions(-) diff --git a/eomaps/eomaps.py b/eomaps/eomaps.py index a24a85795..aaf8b5f4c 100644 --- a/eomaps/eomaps.py +++ b/eomaps/eomaps.py @@ -48,91 +48,6 @@ print("No module named 'mapclassify'... classification will not work!") -def MapsGrid(r=2, c=2, **kwargs): - """ - Initialize a grid of Maps objects - - Parameters - ---------- - r : int, optional - the number of rows. The default is 2. - c : int, optional - the number of columns. The default is 2. - \**kwargs - additional keyword-arguments passed to `matplotlib.gridspec.GridSpec()` - Returns - ------- - eomaps.MapsGrid - Accessor to the Maps objects "ax_{row}_{column}". - - """ - - class MapsGrid: - def __init__(self): - self._axes = [] - - def __iter__(self): - return iter(self._axes) - - def __getitem__(self, key): - return getattr(self, f"ax_{key[0]}_{key[1]}") - - @property - def children(self): - return [i for i in self if i is not self.parent] - - @property - def f(self): - return self.parent.figure.f - - def set_plot_specs(self, **kwargs): - for m in self: - m.set_plot_specs(**kwargs) - - def set_data_specs(self, **kwargs): - for m in self: - m.set_data_specs(**kwargs) - - def set_classify_specs(self, scheme=None, **kwargs): - for m in self: - m.set_classify_specs(scheme=scheme, **kwargs) - - def share_click_events(self): - """ - share click events between all Maps objects of the grid - """ - self.parent.cb.click.share_events(*self.children) - - def share_pick_events(self): - """ - share pick events between all Maps objects of the grid - """ - self.parent.cb.pick.share_events(*self.children) - - def join_limits(self): - """ - join axis limits between all Maps objects of the grid - (only possible if all maps share the same crs!) - """ - self.parent.join_limits(*self.children) - - mg = MapsGrid() - gs = GridSpec(nrows=r, ncols=c, **kwargs) - - for i in range(r): - for j in range(c): - if i == 0 and j == 0: - mij = Maps(gs_ax=gs[0, 0]) - mg.parent = mij - else: - mij = Maps(parent=mg.parent, gs_ax=gs[i, j]) - - mg._axes.append(mij) - setattr(mg, f"m_{i}_{j}", mij) - - return mg - - class Maps(object): """ The base-class for generating plots with EOmaps @@ -2074,3 +1989,112 @@ def indicate_masked_points(self, radius=1.0, **kwargs): m.set_shape.ellipses(radius_crs="out", radius=r) m.plot_map(**kwargs) return m + + +class MapsGrid: + """ + Initialize a grid of Maps objects + + Parameters + ---------- + r : int, optional + the number of rows. The default is 2. + c : int, optional + the number of columns. The default is 2. + \**kwargs + additional keyword-arguments passed to `matplotlib.gridspec.GridSpec()` + Returns + ------- + eomaps.MapsGrid + Accessor to the Maps objects "ax_{row}_{column}". + + """ + + def __init__(self, r=2, c=2, **kwargs): + self._axes = [] + + gs = GridSpec(nrows=r, ncols=c, **kwargs) + + for i in range(r): + for j in range(c): + if i == 0 and j == 0: + mij = Maps(gs_ax=gs[0, 0]) + self.parent = mij + else: + mij = Maps(parent=self.parent, gs_ax=gs[i, j]) + + self._axes.append(mij) + setattr(self, f"m_{i}_{j}", mij) + + def __iter__(self): + return iter(self._axes) + + def __getitem__(self, key): + return getattr(self, f"ax_{key[0]}_{key[1]}") + + @property + def children(self): + return [i for i in self if i is not self.parent] + + @property + def f(self): + return self.parent.figure.f + + @wraps(Maps.set_plot_specs) + def set_plot_specs(self, **kwargs): + for m in self: + m.set_plot_specs(**kwargs) + + @wraps(Maps.set_data_specs) + def set_data_specs(self, **kwargs): + for m in self: + m.set_data_specs(**kwargs) + + @wraps(Maps.set_classify_specs) + def set_classify_specs(self, scheme=None, **kwargs): + for m in self: + m.set_classify_specs(scheme=scheme, **kwargs) + + @wraps(Maps.add_annotation) + def add_annotation(self, *args, **kwargs): + for m in self: + m.add_annotation(*args, **kwargs) + + @wraps(Maps.add_marker) + def add_marker(self, *args, **kwargs): + for m in self: + m.add_marker(*args, **kwargs) + + # @wraps(Maps.add_wms) + # def add_wms(self, *args, **kwargs): + # for m in self: + # m.add_wms(*args, **kwargs) + + @wraps(Maps.add_gdf) + def add_gdf(self, *args, **kwargs): + for m in self: + m.add_wms(*args, **kwargs) + + @wraps(Maps.add_overlay) + def add_overlay(self, *args, **kwargs): + for m in self: + m.add_wms(*args, **kwargs) + + def share_click_events(self): + """ + share click events between all Maps objects of the grid + """ + self.parent.cb.click.share_events(*self.children) + + def share_pick_events(self): + """ + share pick events between all Maps objects of the grid + """ + self.parent.cb.pick.share_events(*self.children) + + def join_limits(self): + """ + join axis limits between all Maps objects of the grid + (only possible if all maps share the same crs!) + """ + self.parent.join_limits(*self.children) From 006d842f21739f569b68c77d9290ada766a2cfb5 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 6 Dec 2021 22:08:54 +0100 Subject: [PATCH 05/19] add additional functions to MapsGrid --- eomaps/eomaps.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eomaps/eomaps.py b/eomaps/eomaps.py index aaf8b5f4c..4c8791155 100644 --- a/eomaps/eomaps.py +++ b/eomaps/eomaps.py @@ -2050,6 +2050,8 @@ def set_data_specs(self, **kwargs): for m in self: m.set_data_specs(**kwargs) + set_data = set_data_specs + @wraps(Maps.set_classify_specs) def set_classify_specs(self, scheme=None, **kwargs): for m in self: @@ -2080,6 +2082,11 @@ def add_overlay(self, *args, **kwargs): for m in self: m.add_wms(*args, **kwargs) + @wraps(Maps.add_coastlines) + def add_coastlines(self, *args, **kwargs): + for m in self: + m.add_marker(*args, **kwargs) + def share_click_events(self): """ share click events between all Maps objects of the grid From ef42d97ed7e9d66c9d5f79fb9718f9a63c73ec84 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 6 Dec 2021 22:09:56 +0100 Subject: [PATCH 06/19] fix typo --- eomaps/eomaps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eomaps/eomaps.py b/eomaps/eomaps.py index 4c8791155..0c4e5e225 100644 --- a/eomaps/eomaps.py +++ b/eomaps/eomaps.py @@ -2085,7 +2085,7 @@ def add_overlay(self, *args, **kwargs): @wraps(Maps.add_coastlines) def add_coastlines(self, *args, **kwargs): for m in self: - m.add_marker(*args, **kwargs) + m.add_coastlines(*args, **kwargs) def share_click_events(self): """ From 5760346af8658a302fcf88dfff33a5ff8e0cafeb Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 6 Dec 2021 22:17:38 +0100 Subject: [PATCH 07/19] fix crs issue with add_gdf --- eomaps/eomaps.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/eomaps/eomaps.py b/eomaps/eomaps.py index 0c4e5e225..bd71d1cc0 100644 --- a/eomaps/eomaps.py +++ b/eomaps/eomaps.py @@ -1297,9 +1297,7 @@ def add_gdf(self, gdf, **kwargs): defaultargs = dict(facecolor="none", edgecolor="k", lw=1.5) defaultargs.update(kwargs) - gdf.to_crs(epsg=self.plot_specs["plot_crs"]).plot( - ax=ax, aspect=ax.get_aspect(), **defaultargs - ) + gdf.to_crs(self.crs_plot).plot(ax=ax, aspect=ax.get_aspect(), **defaultargs) def add_coastlines(self, layer=None, coast=True, ocean=True): """ From cfc1a187939cefe5a13933895acca12c5aaa108f Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 11:01:50 +0100 Subject: [PATCH 08/19] - add _pick_distance=None as default - allow attaching a custom picker --- eomaps/eomaps.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/eomaps/eomaps.py b/eomaps/eomaps.py index bd71d1cc0..b48be0852 100644 --- a/eomaps/eomaps.py +++ b/eomaps/eomaps.py @@ -213,6 +213,9 @@ def __init__( self._ax = gs_ax self._init_ax = gs_ax + # max. pick radius for pick-events + self._pick_distance = None + @property @lru_cache() @wraps(cb_container) @@ -705,8 +708,11 @@ def _pick_pixel(self, artist, event): return False, None - def _attach_picker(self): - self.figure.coll.set_picker(self._pick_pixel) + def _attach_picker(self, picker=None): + if picker is None: + self.figure.coll.set_picker(self._pick_pixel) + else: + self.figure.ax.set_picker(picker) @property @lru_cache() From 5325dba4250be4f2676dec0caf6a567465c8af6b Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 11:03:12 +0100 Subject: [PATCH 09/19] always call plt.show() in _set_axes() --- eomaps/eomaps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eomaps/eomaps.py b/eomaps/eomaps.py index b48be0852..60a9baf90 100644 --- a/eomaps/eomaps.py +++ b/eomaps/eomaps.py @@ -265,7 +265,7 @@ def lims_change(*args, **kwargs): + "when using the 'ipympl' backend to avoid recursions during callbacks!" ) plt.ioff() - plt.show() + plt.show() # def _reset_axes(self): # print("resetting") From 58ef36bf9f935b8e43e02c9fdf0431aa212710cc Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 11:07:49 +0100 Subject: [PATCH 10/19] make sure to call "plt.ion()" before "plt.show()" --- eomaps/eomaps.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eomaps/eomaps.py b/eomaps/eomaps.py index 60a9baf90..62c3c8a34 100644 --- a/eomaps/eomaps.py +++ b/eomaps/eomaps.py @@ -265,6 +265,8 @@ def lims_change(*args, **kwargs): + "when using the 'ipympl' backend to avoid recursions during callbacks!" ) plt.ioff() + else: + plt.ion() plt.show() # def _reset_axes(self): From 56863dd7430a626a98c5d7f90832a3762848c156 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 11:11:42 +0100 Subject: [PATCH 11/19] don't fail install if README can't be read --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1e8b80247..ddf1ec97e 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,10 @@ # add the README as long-description this_directory = Path(__file__).parent -long_description = (this_directory / "README.md").read_text() +try: + long_description = (this_directory / "README.md").read_text() +except Exception: + long_description = "A library to create interactive maps of geographical datasets." version = "2.1.0" From d19d0746f2c453085ea3dac7814d413b14f7ab6c Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 11:13:02 +0100 Subject: [PATCH 12/19] initialize m.figure.coll=None as default --- eomaps/_containers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eomaps/_containers.py b/eomaps/_containers.py index fb1ef0654..385658a49 100644 --- a/eomaps/_containers.py +++ b/eomaps/_containers.py @@ -45,7 +45,8 @@ def __init__( ): self._m = m - # self.coll is assigned in "m.plot_map()" + self.coll = None + # self.coll is assigned in "m.plot_map()" @property def f(self): From b026b4322d184957f6a23ec900bd4df081ed10cb Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 11:19:09 +0100 Subject: [PATCH 13/19] update test-env to include wms dependencies --- tests/test_env.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_env.yml b/tests/test_env.yml index b75a7018b..eec54b7fe 100644 --- a/tests/test_env.yml +++ b/tests/test_env.yml @@ -3,15 +3,23 @@ channels: - conda-forge dependencies: + - rtree - numpy + - scipy - pandas - geopandas - - matplotlib - - cartopy + - matplotlib>=3.0 + - cartopy>=0.20.0 - descartes - mapclassify - pyproj - + - pyepsg + # --------------for WebMaps + - owslib + - requests + - xmltodict + - cairosvg + # --------------for testing - coveralls - pytest - pytest-cov From 71e83177d80234616eabd36a35b26c975432530b Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 11:57:39 +0100 Subject: [PATCH 14/19] don't specify explicit channel for rtree in yml-file (it is not solveable and will fall back to conda-forge anyways) --- docs/general.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general.rst b/docs/general.rst index 71b63048f..bcd7144b9 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -56,7 +56,7 @@ Here's a yaml-file that you can use to install all you need in one go: dependencies: - python=3.7 - - defaults::rtree + - rtree - numpy - scipy - pandas From 4f8fc2ffd30e27bdc98d6fb36a11b9f800a3c871 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 12:17:41 +0100 Subject: [PATCH 15/19] make sure the default marker radius does not need a dataset! --- eomaps/callbacks.py | 20 ++++++++++++++------ eomaps/eomaps.py | 11 +++++++---- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/eomaps/callbacks.py b/eomaps/callbacks.py index 4e6d74012..17f82d21f 100644 --- a/eomaps/callbacks.py +++ b/eomaps/callbacks.py @@ -289,7 +289,7 @@ def _get_values_cleanup(self): def mark( self, - radius="pixel", + radius=None, radius_crs="in", shape="ellipses", buffer=1, @@ -310,11 +310,10 @@ def mark( Parameters ---------- radius : float, string or None, optional - The radius of the marker. - If None, it will be evaluated based on the pixel-spacing of the - provided dataset + If float: The radius of the marker in units of the "radius_crs". If "pixel" the pixel dimensions of the clicked pixel are used - + If None: The radius of the data used for plotting (if available), + otherwise 1/10 of the width and height The default is None. radius_crs : any The crs specification in which the radius is provided. @@ -344,6 +343,15 @@ def mark( kwargs passed to the matplotlib patch. (e.g. `facecolor`, `edgecolor`, `linewidth`, `alpha` etc.) """ + if radius is None: + if self.m.figure.coll is not None: + radius = "pixel" + else: + # make a dot with 1/20 of the widht & height of the figure + t = self.m.figure.ax.bbox.transformed( + self.m.figure.ax.transData.inverted() + ) + radius = (t.width / 10.0, t.height / 10.0) ID, pos, val, ind = self._popargs(kwargs) @@ -362,7 +370,7 @@ def mark( if not hasattr(self.m.shape, "radius"): print( "EOmaps: You cannot attach markers with 'radius=pixel'" - + "if the shape {self.m.shape.name} is used for plotting!" + + f"if the shape {self.m.shape.name} is used for plotting!" ) return radius = self.m.shape.radius diff --git a/eomaps/eomaps.py b/eomaps/eomaps.py index 62c3c8a34..4d8d3dee3 100644 --- a/eomaps/eomaps.py +++ b/eomaps/eomaps.py @@ -1529,7 +1529,7 @@ def add_marker( ID=None, xy=None, xy_crs=None, - radius="pixel", + radius=None, shape="ellipses", buffer=1, **kwargs, @@ -1548,9 +1548,12 @@ def add_marker( xy_crs : any the identifier of the coordinate-system for the xy-coordinates radius : float or "pixel", optional - The radius of the marker. - If "pixel", it will represent the dimensions of the selected pixel. - The default is "pixel" + If float: The radius of the marker. + If "pixel": It will represent the dimensions of the selected pixel. + (check the `buffer` kwarg!) + + The default is None in which case "pixel" is used if a dataset is + present and otherwise a shape with 1/10 of the axis-size is plotted shape : str, optional Indicator which shape to draw. Currently supported shapes are: From b1d0166fdfaf0727aee9bde56837354ca39870a3 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 12:19:19 +0100 Subject: [PATCH 16/19] minor --- docs/api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.rst b/docs/api.rst index 6432655bd..93f952cb4 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -122,7 +122,7 @@ Once the map is generated, a snapshot of the map can be saved at any time by usi .. code-block:: python - m.savefig( "snapshot1.png", dpi=300 ) + m.savefig( "snapshot1.png", dpi=300, ... ) .. currentmodule:: eomaps.Maps From e0314b57deefbad4988f09b6591cc282b7746fb6 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 12:22:10 +0100 Subject: [PATCH 17/19] first steps to allow adding custom pickers --- eomaps/_cb_container.py | 84 +++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 36 deletions(-) diff --git a/eomaps/_cb_container.py b/eomaps/_cb_container.py index e9164e76a..65710a23d 100644 --- a/eomaps/_cb_container.py +++ b/eomaps/_cb_container.py @@ -597,13 +597,18 @@ def _onpick(self, event): ) and self._m.figure.f.canvas.toolbar.mode != "": return - if event.artist != self._m.figure.coll: - return + if event.artist != self._m.figure.coll or event.artist is None: + clickdict = dict( + ID=event.ind if hasattr(event, "ind") else None, + pos=(event.mouseevent.xdata, event.mouseevent.ydata), + val=None, + ind=event.ind, + ) + event = event.mouseevent + # return else: clickdict = self._get_pickdict(event) - clickdict = self._get_pickdict(event) - if event.dblclick: cbs = self.get.cbs["double"] else: @@ -616,36 +621,39 @@ def _onpick(self, event): if clickdict is not None: cb(**clickdict) - def _add_pick_callback(self): + def _add_pick_callback(self, pickcb=None): # only attach pick-callbacks if there is a collection available! - if self._m.figure.coll is None: - return + # if self._m.figure.coll is None: + # return # ------------- add a callback # execute onpick on the parent and all its children # (_add_pick_callback() is only called on the parent object!) - def pickcb(event): - self._event = event - - # ignore callbacks while dragging axes - if self._m._draggable_axes._modifier_pressed: - return - # don't execute callbacks if a toolbar-action is active - if ( - self._m.figure.f.canvas.toolbar is not None - ) and self._m.figure.f.canvas.toolbar.mode != "": - return - - # execute "_onpick" on the maps-object that belongs to the clicked axes - # and forward the event to all forwarded maps-objects - for obj in self.objs: - obj._onpick(event) - obj._m.BM._after_update_actions.append(obj._clear_temporary_artists) - # forward callbacks to the connected maps-objects - obj._fwd_cb(event) - - # self._m.parent.BM.update(clear=self._method) - # don't update here... the click-callback will take care of it! - self._m.parent.BM._clear_temp_artists(self._method) + if pickcb is None: + + def pickcb(event): + print("asdf") + self._event = event + + # ignore callbacks while dragging axes + if self._m._draggable_axes._modifier_pressed: + return + # don't execute callbacks if a toolbar-action is active + if ( + self._m.figure.f.canvas.toolbar is not None + ) and self._m.figure.f.canvas.toolbar.mode != "": + return + + # execute "_onpick" on the maps-object that belongs to the clicked axes + # and forward the event to all forwarded maps-objects + for obj in self.objs: + obj._onpick(event) + obj._m.BM._after_update_actions.append(obj._clear_temporary_artists) + # forward callbacks to the connected maps-objects + obj._fwd_cb(event) + + # self._m.parent.BM.update(clear=self._method) + # don't update here... the click-callback will take care of it! + self._m.parent.BM._clear_temp_artists(self._method) if self._cid_pick_event is None: # ------------- add a callback @@ -671,11 +679,6 @@ def _fwd_cb(self, event): event.mouseevent.xdata, event.mouseevent.ydata ) - dummyevent = SimpleNamespace( - artist=m.figure.coll, - dblclick=event.dblclick, - button=event.button, - ) dummymouseevent = SimpleNamespace( inaxes=m.figure.ax, dblclick=event.dblclick, @@ -685,8 +688,17 @@ def _fwd_cb(self, event): # x=event.mouseevent.x, # y=event.mouseevent.y, ) + dummyevent = SimpleNamespace( + artist=m.figure.coll, + dblclick=event.dblclick, + button=event.button, + inaxes=m.figure.ax, + xdata=xdata, + ydata=ydata, + mouseevent=dummymouseevent, + ) - pick = m._pick_pixel(None, dummymouseevent) + pick = m._pick_pixel(None, event.mouseevent) if pick[1] is not None: dummyevent.ind = pick[1]["ind"] if "dist" in pick[1]: From c58fb9bc88a66f46e1702fa136becd6122824295 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 12:23:37 +0100 Subject: [PATCH 18/19] remove unneccessary print --- eomaps/_cb_container.py | 1 - 1 file changed, 1 deletion(-) diff --git a/eomaps/_cb_container.py b/eomaps/_cb_container.py index 65710a23d..a3e76bebe 100644 --- a/eomaps/_cb_container.py +++ b/eomaps/_cb_container.py @@ -631,7 +631,6 @@ def _add_pick_callback(self, pickcb=None): if pickcb is None: def pickcb(event): - print("asdf") self._event = event # ignore callbacks while dragging axes From ae2170b9b47211124f75a67bf99fb1ebdea3328e Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 7 Dec 2021 12:48:43 +0100 Subject: [PATCH 19/19] update version number --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ddf1ec97e..f5dcb85f8 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ except Exception: long_description = "A library to create interactive maps of geographical datasets." -version = "2.1.0" +version = "2.1.1" setup( name="EOmaps",