EOmaps v3.0
EOmaps v3.0 comes with a lot of usability improvements and some nice new features!
❗ NOTE: There are breaking changes compared to EOmaps v2.x
... if you used EOmaps before, make sure to take a quick look at the list below!
(or check the examples in the doc which have been updated accordingly)
❗ details on breaking changes with respect to EOmaps v2.x - [click to expand]
-
Removed functions and properties:
m.add_overlay,m.add_coastlines,m.crs_list -
Changed arguments and/or behavior:
Maps,MapsGrid,m.copy,m.plot_map,m.add_gdf,m.add_colorbar -
New functions:
m.new_layer,m.add_feature,m.add_logo,m.cb.pick.highlight_geometry- ❗
m.add_overlayandm.add_coastlineshave been removed in favor ofm.add_feature- ⭐ use
m.add_feature.<category>.<feature>( ... )instead
- ⭐ use
- ❗ the
coastlinesas well as thecolorbarargument form.plot_map()have been removed- ⭐ use
m.add_feature.preset.coastline()orm.ax.coastlines()instead - ⭐ use
m.add_colorbar()after callingm.plot_map()to add a colorbar for an existing map
- ⭐ use
- ❗ the arguments and behavior of
m.copy(...)have changed
(note that most of the time users anyway will want the new ⭐m.new_layer()function)- all arguments of
m.copyare now without the "copy_" prefix, e.g.: "data" instead of "copy_data" etc.
- all arguments of
- ❗ the first argument of
Mapsis now the plot-crs (e.g.Maps(crs=3857)is the same asm.plot_specs.crs=3857)
and additionalkwargsare forwarded to the initialization of the matplotlib-figure (e.g.plt.figure)
- ❗
🌳 New
⭐ the plot coordinate-system is now specified directly on initialization of Maps object
- ❗ NOTE: this replaces
m.set_plot_specs(crs=...)as well asm.plot_specs.crs=... - additional kwargs are passed to the initialization of the
matplotlibfigure
m=Maps(crs=4326, figsize=(10,5))⭐ there's a new function m.new_layer() that simplifies adding new layers to a map
- it simply returns a new
Mapsobject that shares the figure and plot-axes.
⭐ EOmaps now supports multiple ways for providing datasets!
- a single
pandas.DataFramecontaining both values and coordinates (the only option for EOmaps < v2.4.2) - individual
pandas.Seriesfor data-values and coordinates - individual 1D or 2D
numpy.arraysfor data-values and coordinates - individual 1D lists for data-values and coordinates
⭐ The new m.add_feature container provides direct access to ALL NaturalEarth features!
- ❗ NOTE: this replaces
m.add_overlayandm.add_coastlines - autocompletion helps with identifying the relevant NaturalEarth features
- e.g.
m.add_feature.physical_10m.<...feature...>(...)orm.add_feature.cultural_50m.<...feature...>(...)
- e.g.
- with
geopandasinstalled, NaturalEarth features can be interactive too!
(adding static layers works also withoutgeopandas)
# access specific NaturalEarth layers:
m.add_feature.cultural_50m.admin_0_countries(fc="red", ec="k", alpha=0.5)
# there are some presets to quickly add commonly used features
m.add_feature.preset.ocean() # (coastline, land, countries)
# make the layers interactive (requires geopandas)!
m.add_feature.cultural_50m.admin_0_countries(fc="none", ec="k", picker_name="countries")
m.cb.pick["countries"].attach.highlight_geometry(fc="r")⭐ there's a new function m.add_logo that can be used to add images to the map
- particularly useful to add a smal logo in the corner of a plot
⭐ a lot of improvements to m.add_gdf
- it is now possible to pick a geometry based on the closest
"centroids"or based on a"contains"query- with this, picking now also works for lines and points!
# for picking lines and points m.add_gdf(gdf, picker_name="pickername", pick_method="centroids") m.cb.pick["pickername"].attach.<...> # for picking polygons m.add_gdf(gdf, picker_name="pickername2", pick_method="contains") m.cb.pick["pickername2"].attach.<...>
⭐ there's a new pre-defined callback m.cb.pick[<name>].highlight_geometries
- this callback is exclusive to
geopandas.GeoDataFramesand allows highlighting a shape when you click on it!
⭐ m.add_colorbar() can now be used to add colorbars to existing Maps!
- ❗ NOTE: this replaces the old
colorbar-argument ofm.plot_map()
⭐ MapsGrid now supports additional functionalities
- use
MapsGrid(crs=...)to specify the crs
(unique crs for each Maps-objects can be specified by passinglistsordicts) - there are a lot of new convenience-functions to execute actions on all
Mapsobjects on the grid:mgrid.add_feature,mgrid.add_wms,mgrid.add_colorbar,mgrid.set_shape,mgrid.add_logo
⭐ the plot-axis can now be accessed directly via m.ax
⭐ possible crs for plotting are now accessible via Maps.CRS and possible classifiers are accessible via Maps.CLASSIFIERS
🔧 fixes
- fix
m.cb.pick.plotcallback - fix forwarding of event attributes
- treatment of point- or line-like NaturalEarth features
- fix
layerkwarg form.add_gdf - a lot more unittests!
- allow positional arguments for
m.set_data(orm.set_data_specs)