oneworld.StaticMap.add_markers

StaticMap.add_markers(latitude, longitude, size=10, color='#592a8a', data=None, sizes=(5, 15), n_colors=5, palette='Spectral', legend_pos='lower center', marker='o', legend_labels=4, legend_ndec=2, crs='Geodetic', cap_min=False, cap_max=False, legend_show=True, legend_kwargs={}, plt_kwargs={})

Add markers to the map.

Location of markers can be specified via a sequence or a dataframe. Colors and sizes of markers can be specified in the same way, or using a single color and/or size which will be common to all markers.

Parameters:
  • latitude (list or tuple or str) – Sequence (list or tuple) or name of the column of the dataframe in data containing the longitude coordinate for each marker.

  • longitude (list or tuple or str) – Sequence (list or tuple) or name of the column of the dataframe in data containing the latitude coordinate for each marker.

  • size (list or tuple or str or int) – Sequence (list or tuple) or name of the column of the dataframe in data containing the values that will be used to calculate the size of each marker. Alternatively, it can be a single numerical value, assigning the same size (in pixels) to all markers (Default: 10).

  • color (list or tuple or str) – Sequence (list or tuple) or name of the column of the dataframe in data containing the values that will be used to determine the color of each marker. These values can be numeric (float or int) or categorical (str). Alternatively, color can be a hex color that will be applied to all the markers (Default: ‘#592a8a’).

  • data (pandas DataFrame) – Dataframe containing one or more columns of values to use. Each row must contain the data for a marker, with columns as the data to be used (Default: None).

  • sizes (list or tuple of 2 elements) – Only relevant if size is not int. Range of sizes (in pixels) to use for the markers (Default: (5, 15)).

  • palette (list or tuple or str) – Only relevant when color is not a str corresponding to a hex color. Sequence of hex colors to be used to color the circles according to their value provided in color. Alternatively, palette can be a string with the name of a seaborn color palette https://seaborn.pydata.org/tutorial/color_palettes.html (Default: ‘Spectral’).

  • n_colors (int) – Number of colors in the specified seaborn palette (Default: 5).

  • marker (str) – Shape of marker to use. See https://matplotlib.org/3.2.1/api/markers_api.html (Default: ‘o’).

  • cap_min (float or int) – If set, all numerical values less than this value will have the same characteristics (color, size, …). Ignored for categorical data (Default: False).

  • cap_max (float or int) – If set, all numerical values greater than this value will have the same characteristics (color, size, …). Ignored for categorical data (Default: False).

  • legend_show (bool) – If True, display a color and/or size legend (Default: True).

  • legend_labels (int or list or tuple) – If int, number of points in the sizes legend (will be plotted as evenly separated values as possible), or seq containg the values to be displayed on the sizes legend. The color of the points on the legend will be that defined in color (Default: 4).

  • legend_pos ({'best', 'upper right', 'upper left', 'lower left', 'lower right', 'right', 'center left', 'center right', 'lower center', 'upper center', 'center'}) – Only relevant when legend_show is True. Position of the legend (Default: ‘lower center’).

  • legend_ndec (int) – Only relevant when legend_show is True. Number of decimal places to be displayed on the legend (Default: 2).

  • crs (str) – Coordinate reference system on which latitude and longitude are specified. See https://scitools.org.uk/cartopy/docs/latest/crs/index.html for a full list of supported crs (Default: ‘Geodetic’).

  • plt_kwargs (dict) – Dict with extra args to pass to the plot function (Default: {}).

  • leg_kwargs (dict) – Dict with extra args to pass to the legend function (Default: {}).