cityImage.plot_gdf#
- cityImage.plot_gdf(gdf, column=None, title=None, black_background=True, figsize=(15, 15), scheme=None, bins=None, classes=None, norm=None, cmap=None, color=None, alpha=None, geometry_size=1.0, geometry_size_column=None, geometry_size_factor=None, legend=False, fontsize=15, cbar=False, cbar_ticks=5, cbar_max_symbol=False, cbar_min_max=False, cbar_shrink=0.75, axes_frame=False, base_map_gdf=Empty DataFrame Columns: [a] Index: [], base_map_color=None, base_map_alpha=0.4, base_map_geometry_size=1.1, base_map_zorder=0)[source]#
It plots the geometries of a single GeoDataFrame, coloring on the bases of the values contained in column, using a given scheme. When only column is provided (no scheme), a categorical map is depicted. When no column is provided, a plain map is shown.
The other parameters regulate colorbar, legend, base map. Use this function for plotting in relation to maximum one column, one GeoDataFrame.
- Parameters:
gdf (GeoDataFrame) – GeoDataFrame to be plotted.
column (str) – Column on which the plot is based.
title (str) – Title of the plot.
black_background (bool) – Specifies whether the plot has a black background (True) or white background (False).
fig_size (float) – Size of the figure’s side extent.
scheme (str) – Classification method. Choose amongst the options listed at https://pysal.org/mapclassify/api.html.
bins (list) – Bins defined by the user.
classes (int) – Number of classes for categorizing the data when scheme is not “None”.
norm (array) – A class that specifies a desired data normalization into a [min, max] interval.
cmap (str or matplotlib.colors.LinearSegmentedColormap) – Color map for the plot. See matplotlib colormaps for a list of possible values or pass a colormap.
color (str) – Categorical color applied to all geometries when not using a column to color them.
alpha (float) – Alpha value of the plotted layer.
geometry_size (float) – Point size value when plotting a Point GeoDataFrame or Width value when plotting LineString GeoDataFrame.
geometry_size_columns (List of str) – The column name in the GeoDataFrame to be used for scaling for manipulating the geometry size.
geometry_size_factor (float) – Rescaling factor for the column provided, if any. The column is rescaled from 0 to 1, and the geometry_size_factor is used to rescale the marker size accordingly (e.g., rescaled variable’s value [0-1] * factor) when plotting a Point GeoDataFrame.
legend (bool) – When True, show the legend.
fontsize (int) – Font size.
cbar (bool) – If True, show the colorbar; otherwise, don’t. When True, the legend is not shown.
cbar_ticks (int) – Number of ticks along the colorbar.
cbar_max_symbol (bool) – If True, show the “>” next to the highest tick’s label in the colorbar (useful when normalizing).
cbar_min_max (bool) – If True, only show the “>” and “<” as labels of the lowest and highest ticks’ the colorbar.
cbar_shrink – Fraction by which to multiply the size of the colorbar.
axes_frame (bool) – If True, show the axes’ frame.
base_map_gdf (GeoDataFrame) – Additional layer to use as a base map.
base_map_color (str) – Color applied to all geometries of the base map.
base_map_alpha (float) – Base map’s alpha value.
base_map_geometry_size (float) – Base map’s marker size when the base map is a Point GeoDataFrame.
base_map_zorder (int) – Z-order of the layer. If 0, plots first, thus main GeoDataFrame on top; if 1, plots last, thus on top.
- Returns:
fig – the resulting figure
- Return type:
matplotlib.figure.Figure object