Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make dwc_make_map function? #12

Open
MathewBiddle opened this issue Dec 23, 2022 · 2 comments
Open

make dwc_make_map function? #12

MathewBiddle opened this issue Dec 23, 2022 · 2 comments

Comments

@MathewBiddle
Copy link

This looks like a great package of nice tools! As I'm working more and more with DwC data, either during reformatting or extracting using pyobis, I find myself rewriting this little bit of code in all my notebooks to make a simple map of observations. It got me thinking, is this something that would be appropriate to be added to this package?

Something like py-dwc-viz.dwc_make_map(DataFrame), where DataFrame contains decimalLongitude and decimalLatitude, at a minimum.

import matplotlib.pyplot as plt
import geopandas as gpd

  # read into geopandas dataframe for plotting
gdf = gpd.GeoDataFrame(
    df, 
    geometry=gpd.points_from_xy(df.decimalLongitude, df.decimalLatitude),
    crs = "epsg:4326",
    )


fig, ax = plt.subplots(figsize=(20,10))

gdf.plot(ax=ax, markersize=5, zorder=10, legend=True)

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))

world = world.to_crs(gdf.crs)

world.plot(ax=ax, color='lightgrey', edgecolor='white', zorder=1)

ax.set_axis_off()

plt.show()
@ayushanand18
Copy link
Member

Something like py-dwc-viz.dwc_make_map(DataFrame), where DataFrame contains decimalLongitude and decimalLatitude, at a minimum.

This is a great suggestion and thank you so much for it! I am not sure where to put it into this package. Currently we have three modules, stats to view statistics of records distribution, taxon plotting distribution of taxa against many parameters, and diversity to account for diversity indices. I believe a function to taxon module like make_map() would be good?

@7yl4r
Copy link
Member

7yl4r commented Dec 26, 2022

I suggest we structure visualizations of DwC data using a structure inspired by https://www.python-graph-gallery.com/.

This code plots all points as markers, right? So perhaps this function could live in map.bubble?

Also worth noting that python-graph-gallery is missing a few map subtypes. For instance:

  • map.raster
  • map.points (arguable if this is a subtype of map.bubble)
  • map.heatmap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants