oraclesai.vis.plot_clusters

plot_clusters(X, labels_, background_data=None, title=None, with_bounds=False, with_noise: bool | Dict = False, ax=None, cmap='prism', with_legend=True, with_basemap=False, crs=None, alpha=0.5)

Plot clustering result using matplotlib.

Parameters:
  • X – (SpatialDataFrame or geopandas.GeoDataFrame) The geometries to be plotted.

  • labels – Cluster labels to be associated to X.

  • background_data – (SpatialDataFrame or geopandas.GeoDataFrame) A spatial dataset used as background.

  • title – Title of the plot.

  • with_bounds – If True, the clusters will be drawn as a polygon.

  • with_noise – bool or dictionary. If True or a dictionary is passed, and the clustering algorithm categorizes some samples as noise (value -1), it will plot the noise samples. A dictionary can be passed with the followin properties: color, alpha.

  • ax – axes on which to draw the plot.

  • cmap – Color map from matplotlib.

  • with_legend – If True, the legend with the clusters labels will be added to the plot.

  • with_basemap – (boolean, xyzservices.TileProvider or dictionary). Specifies if a basemap should be added. If True, the default basemap will be used. If a TileProvider instance is passed (e.g., elocation.osm_bright), it will be used as basemap. Alternativelly, a dictionary can be passed with the parameters to oraclesai.vis.add_basemap(), except ax.

  • crs – (pyproj.CRS, or string) Coordinate Reference System of the geometry objects to be plotted. By default the X.crs is used.

  • alpha – Alpha used for X’s geometries.