oneworld.StaticMap
- class oneworld.StaticMap(position=None, view='USA', create_fig=True, size=(12, 9), projection='PlateCarree', tiles_zoom=10, nation_borders=None, inner_borders=None, pop_areas=None, physical=None, resolution='110m', **kwargs)
Base static map object.
- Parameters:
position (tuple or None) – Position of the map inside the figure object, in figure relative coordinates (left, bottom, width, height), or None for full window map (Default: None).
view (list or str) – Window span in coordinates (longitude 1, longitude 2, latitude 1, latitude 2), or string indicating a predefined span (available predefined spans: “NC”, “USA”, “World”) (Default: “USA”).
create_fig (bool) – Create a new empty figure object when creating the map (Default: ‘True’).
size (tuple) – Size of the figure in hundreds of pixels in (width, height) format (Default: (12, 9)).
projection (str) – Name of the projection to use. Standard cartopy projections are supported (see https://scitools.org.uk/cartopy/docs/latest/crs/projections.html) plus the ‘MercatorGoogle’, ‘MercatorStamen’ and ‘OSM’ tiles set (Default: ‘PlateCarree’).
tiles_zoom (int) – Level of tile zoom in case a projection with tiles is selected (Default: 10).
nation_borders (list or tuple or None) – Sequence of strings of 3 characters, each string representing the ISO 3166 country code for which to plot the national borders, or None for no national borders (Default: None).
inner_borders (list or tuple or None) – Sequence of strings of 3 characters, each string representing the ISO 3166 country code for which to plot the inner (regional) borders, or None for no national borders (Default: None).
pop_areas (list or tuple or None) – Sequence of strings of 3 characters, each string representing the ISO 3166 country code for which to plot the most populated areas (capitals, major cities and towns), or None for no national borders (Default: None).
physical (str or None) – Add physical features to map. Currently supported features are: ‘rivers’ for river centerlines, ‘lakes’ to display lake areas, and ‘rivers_na’ and ‘lakes_na’ to display supplementary data for rivers and lakes in North America (Default: None).
resolution ({'10m', '50m', '110m'}) – Resolution of nation and inner borders, populated areas and physical features when requested (Default: ‘110m’).
**kwargs – Extra keyword arguments for the projection (see https://scitools.org.uk/cartopy/docs/latest/crs/projections.html)
- Variables:
position (tuple or None) – Position of the map inside the figure object, in figure relative coordinates (left, bottom, width, height), or None for full window map.
view (list or str) – Window span in coordinates (longitude 1, longitude 2, latitude 1, latitude 2), or string indicating a predefined span.
create_fig (bool) – Create a new empty figure object when creating the map.
size (tuple) – Size of the figure in inches in (width, height) format.
projection (str) – Name of the projection used.
tiles_zoom (int) – Level of tile zoom in case a projection with tiles is selected.
nation_borders (list or tuple or None) – Sequence of strings of 3 characters, each string representing the ISO 3166 country code for which to plot the national borders, or None for no national borders.
inner_borders (list or tuple or None) – Sequence of strings of 3 characters, each string representing the ISO 3166 country code for which to plot the inner (regional) borders, or None for no national borders.
pop_areas (list or tuple or None) – Sequence of strings of 3 characters, each string representing the ISO 3166 country code for which to plot the most populated areas (capitals, major cities and towns), or None for no national borders.
physical (str or None) – Add physical features to map.
resolution ({'10m', '50m', '110m'}) – Resolution of nation and inner borders, populated areas and physical features when requested.
fig (object) – Matplotlib figure object containing the map.
ax (object) – Matplotlib axes object containing the map.
data (object) – Pandas dataframe containing the last input data used in the map.
lat_col (str) – Name of the column in data containing the latitude coordinates.
lon_col (str) – Name of the column in data containing the longitude coordinates.
text_col (str) – Name of the column in data containing the text to be displayed.
col_col (str) – Name of the column in data containing the values to be used to determine the color.
siz_col (str) – Name of the column in data containing the values to be used to determine the size.
col_def (bool) – Whether all the elements will have the same color property value.
siz_def (bool) – Whether all the elements will have the same size property value.
col_lst (list) – List containing the colors of the last input elements.
col_leg (list) – List containing the entries of the color legend. Each entry consists of two elements: the label and the color in hex code.
siz_lst (list) – List containing the sizes of the last input elements.
siz_leg (list) – List containing the entries of the sizes legend. Each entry consists of two elements: the label and the corresponding size.
sm (object) – Matplotlib Scalar Mappable object used for the last input data.
- __init__(position=None, view='USA', create_fig=True, size=(12, 9), projection='PlateCarree', tiles_zoom=10, nation_borders=None, inner_borders=None, pop_areas=None, physical=None, resolution='110m', **kwargs)
Constructor
Methods
__init__
([position, view, create_fig, size, ...])Constructor
add_choropleth
(shp_file, geoid, color[, ...])Add a choropleth to the map.
add_colorbar
([legend_pos, cap_min, cap_max, ...])Add a colorbar to the map.
add_legend
(marker, legend_pos, plt_kwargs, ...)Add a legend to the map.
add_markers
(latitude, longitude[, size, ...])Add markers to the map.
add_shp
(shp_file[, subset, subset_key, ...])Add polygons from a shapefile.
add_txt
(latitude, longitude, text[, data, ...])Add text to the map.
get_projection
(proj, **kwargs)Get the map projection.
Plot the inner borders for given countries.
Plot the outter border for given countries.
Add physical features to the map.
plot_pop
()Plot populated areas for given countries.
savemap
(filename[, tight])Save the map to a file.