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

User Guide missing Dependency: mapclassify Required for examples. #680

Open
speco29 opened this issue Feb 10, 2025 · 0 comments
Open

User Guide missing Dependency: mapclassify Required for examples. #680

speco29 opened this issue Feb 10, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@speco29
Copy link

speco29 commented Feb 10, 2025

Description / Summary

I was following the momepy user guide and encountered an error because a required package mapclassify to use 'scheme' which was not mentioned in the guide. Suggest adding a section to the documentation that lists all necessary dependencies for the examples provided.

ax = tessellation.plot(
    "CAR",
    edgecolor="white",
    legend=True,
    scheme="NaturalBreaks",
    k=10,
    legend_kwds={"loc": "lower left"},
    figsize=(8, 8),
)
buildings.plot(ax=ax, color="white", alpha=0.5)
ax.set_axis_off()

the raised error was:

ModuleNotFoundError                       Traceback (most recent call last)
File ~\anaconda3\Lib\site-packages\geopandas\plotting.py:739, in plot_dataframe(df, column, cmap, color, ax, cax, categorical, legend, scheme, k, vmin, vmax, markersize, figsize, legend_kwds, categories, classification_kwds, missing_kwds, aspect, autolim, **style_kwds)
    738 try:
--> 739     import mapclassify
    741 except ImportError:

ModuleNotFoundError: No module named 'mapclassify'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
Cell In[20], line 1
----> 1 ax = tessellation.plot(
      2     "CAR",
      3     edgecolor="white",
      4     legend=True,
      5     scheme="NaturalBreaks",
      6     k=10,
      7     legend_kwds={"loc": "lower left"},
      8     figsize=(8, 8),
      9 )
     10 buildings.plot(ax=ax, color="white", alpha=0.5)
     11 ax.set_axis_off()

File ~\anaconda3\Lib\site-packages\geopandas\plotting.py:968, in GeoplotAccessor.__call__(self, *args, **kwargs)
    966 kind = kwargs.pop("kind", "geo")
    967 if kind == "geo":
--> 968     return plot_dataframe(data, *args, **kwargs)
    969 if kind in self._pandas_kinds:
    970     # Access pandas plots
    971     return PlotAccessor(data)(kind=kind, **kwargs)

File ~\anaconda3\Lib\site-packages\geopandas\plotting.py:742, in plot_dataframe(df, column, cmap, color, ax, cax, categorical, legend, scheme, k, vmin, vmax, markersize, figsize, legend_kwds, categories, classification_kwds, missing_kwds, aspect, autolim, **style_kwds)
    739     import mapclassify
    741 except ImportError:
--> 742     raise ImportError(mc_err)
    744 if Version(mapclassify.__version__) < Version("2.4.0"):
    745     raise ImportError(mc_err)

ImportError: The 'mapclassify' package (>= 2.4.0) is required to use the 'scheme' keyword.

Value / benefit

  • Enhanced User Experience: Ensuring that all required libraries are listed will make it easier for new users to get started with momepy without running into unexpected errors.

Implementation details

This change probably be here http://docs.momepy.org/en/latest/user_guide/getting_started.html, where we are importing the packages for the examples.

Tasks to complete

No response

@speco29 speco29 added the enhancement New feature or request label Feb 10, 2025
speco29 added a commit to speco29/momepy that referenced this issue Feb 10, 2025
Added the missing dependency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant