+
Skip to content

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

Open
@speco29

Description

@speco29

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载