Plotting¶
This module contains plotting methods.
We provide some high-level plotting methods which work on the outputs of different srai
components. By default, folium
based functions are exposed within plotting
module. Additional
functions can be found in srai.plotting.plotly_wrapper
module.
Functions¶
srai.plotting.plot_all_neighbourhood(
regions_gdf,
region_id,
neighbourhood,
neighbourhood_max_distance=100,
tiles_style="OpenStreetMap",
height="100%",
width="100%",
colormap=px.colors.sequential.Agsunset_r,
map=None,
show_borders=True,
)
¶
srai.plotting.plot_all_neighbourhood(
regions_gdf,
region_id,
neighbourhood,
neighbourhood_max_distance=100,
tiles_style="OpenStreetMap",
height="100%",
width="100%",
colormap=px.colors.sequential.Agsunset_r,
map=None,
show_borders=True,
)
Plot full neighbourhood on a map using Folium library.
PARAMETER | DESCRIPTION |
---|---|
regions_gdf |
Region indexes and geometries to plot.
TYPE:
|
region_id |
Center
TYPE:
|
neighbourhood |
TYPE:
|
neighbourhood_max_distance |
Max distance for rendering neighbourhoods. Neighbours farther away won't be coloured, and will be left as "other" regions. Defaults to 100.
TYPE:
|
tiles_style |
Map style background. For more styles, look at tiles param at https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.explore.html. Defaults to "OpenStreetMap".
TYPE:
|
height |
Height of the plot. Defaults to "100%".
TYPE:
|
width |
Width of the plot. Defaults to "100%".
TYPE:
|
colormap |
Colormap to apply to the neighbourhoods.
Defaults to
TYPE:
|
map |
Existing map instance on which to draw the plot. Defaults to None.
TYPE:
|
show_borders |
Whether to show borders between regions or not. Defaults to True.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
folium.Map
|
folium.Map: Generated map. |
Source code in srai/plotting/folium_wrapper.py
srai.plotting.plot_neighbours(
regions_gdf,
region_id,
neighbours_ids,
tiles_style="OpenStreetMap",
height="100%",
width="100%",
map=None,
show_borders=True,
)
¶
srai.plotting.plot_neighbours(
regions_gdf,
region_id,
neighbours_ids,
tiles_style="OpenStreetMap",
height="100%",
width="100%",
map=None,
show_borders=True,
)
Plot neighbours on a map using Folium library.
PARAMETER | DESCRIPTION |
---|---|
regions_gdf |
Region indexes and geometries to plot.
TYPE:
|
region_id |
Center
TYPE:
|
neighbours_ids |
List of neighbours to highlight.
TYPE:
|
tiles_style |
Map style background. For more styles, look at tiles param at https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.explore.html. Defaults to "OpenStreetMap".
TYPE:
|
height |
Height of the plot. Defaults to "100%".
TYPE:
|
width |
Width of the plot. Defaults to "100%".
TYPE:
|
map |
Existing map instance on which to draw the plot. Defaults to None.
TYPE:
|
show_borders |
Whether to show borders between regions or not. Defaults to True.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
folium.Map
|
folium.Map: Generated map. |
Source code in srai/plotting/folium_wrapper.py
srai.plotting.plot_numeric_data(
regions_gdf,
data_column,
embedding_df=None,
tiles_style="CartoDB positron",
height="100%",
width="100%",
colormap=px.colors.sequential.Sunsetdark,
map=None,
show_borders=False,
opacity=0.8,
)
¶
srai.plotting.plot_numeric_data(
regions_gdf,
data_column,
embedding_df=None,
tiles_style="CartoDB positron",
height="100%",
width="100%",
colormap=px.colors.sequential.Sunsetdark,
map=None,
show_borders=False,
opacity=0.8,
)
Plot numerical data within regions shapes using Folium library.
PARAMETER | DESCRIPTION |
---|---|
regions_gdf |
Region indexes and geometries to plot.
TYPE:
|
embedding_df |
Region indexes and numerical data to plot. If not provided, will use regions_gdf.
TYPE:
|
data_column |
Name of the column used to colour the regions.
TYPE:
|
tiles_style |
Map style background. For more styles, look at tiles param at https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.explore.html. Defaults to "CartoDB positron".
TYPE:
|
height |
Height of the plot. Defaults to "100%".
TYPE:
|
width |
Width of the plot. Defaults to "100%".
TYPE:
|
colormap |
Colormap to apply to the regions. Defaults to px.colors.sequential.Sunsetdark.
TYPE:
|
map |
Existing map instance on which to draw the plot. Defaults to None.
TYPE:
|
show_borders |
Whether to show borders between regions or not. Defaults to False.
TYPE:
|
opacity |
Opacity of coloured regions.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
folium.Map
|
folium.Map: Generated map. |
Source code in srai/plotting/folium_wrapper.py
srai.plotting.plot_regions(
regions_gdf,
tiles_style="OpenStreetMap",
height="100%",
width="100%",
colormap=px.colors.qualitative.Bold,
map=None,
show_borders=True,
)
¶
srai.plotting.plot_regions(
regions_gdf,
tiles_style="OpenStreetMap",
height="100%",
width="100%",
colormap=px.colors.qualitative.Bold,
map=None,
show_borders=True,
)
Plot regions shapes using Folium library.
PARAMETER | DESCRIPTION |
---|---|
regions_gdf |
Region indexes and geometries to plot.
TYPE:
|
tiles_style |
Map style background. For more styles, look at tiles param at https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.explore.html. Defaults to "OpenStreetMap".
TYPE:
|
height |
Height of the plot. Defaults to "100%".
TYPE:
|
width |
Width of the plot. Defaults to "100%".
TYPE:
|
colormap |
Colormap to apply to the regions.
Defaults to
TYPE:
|
map |
Existing map instance on which to draw the plot. Defaults to None.
TYPE:
|
show_borders |
Whether to show borders between regions or not. Defaults to True.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
folium.Map
|
folium.Map: Generated map. |