oneworld.WebMap.add_lines

WebMap.add_lines(latitude0, longitude0, latitude1, longitude1, size=3, color='#592a8a', data=None, sizes=(3, 15), n_colors=5, palette='Spectral', cap_min=False, cap_max=False, layer='map', style={'fillOpacity': 0.6, 'opacity': 1.0}, style_mouseover=None, info_mouseover=None, legend_pos='bottomright', legend_ndec=2, _source=None, _target=None)

Add lines connecting specific locations.

Input can be in the form of a pandas dataframe, or in lists or tuples, or a combination of both. The color and the width of each line can be associated to the value of a variable (set in the color and size parameters). In the case of color, this variable can contain numeric or categorical data. Check out the tutorial.

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

  • longitude0 (list or tuple or str) – Sequence (list or tuple) or name of the column of the dataframe in data containing the latitude coordinate for the starting point of each line.

  • latitude1 (list or tuple or str) – Sequence (list or tuple) or name of the column of the dataframe in data containing the longitude coordinate for the ending point of each line.

  • longitude1 (list or tuple or str) – Sequence (list or tuple) or name of the column of the dataframe in data containing the latitude coordinate for the enfing point of each line.

  • 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 width of each line. Alternatively, it can be a single numerical value, assigning the same width to all lines (Default: 3).

  • 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 line. These values can be numeric (float or int) or categorical (str). Alternatively, color can be a hex color that will be applied to all lines (Default: ‘#592a8a’).

  • data (pandas DataFrame) – Dataframe containing one or more columns of values to use. Each row must contain the data for a line, 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 widths to use for the lines (Default: (3, 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 lines according to their value provided in color. Alternatively, palette can be a string with the name of a seaborn color palette (Default: ‘Spectral’).

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

  • cap_min (float or int) – If set, all lines with a numerical value in color smaller than the value set in cap_min will be considered as having a value equal to cap_min for coloring purposes. The corresponding entry in the legend will display a ‘<’ sign. (Default: False).

  • cap_max (float or int) – If set, all lines with a numerical value in color greater than the value set in cap_max will be considered as having a value equal to cap_max for coloring purposes. The corresponding entry in the legend will display a ‘>’ sign. (Default: False).

  • layer (list or tuple or str) – Sequence (list or tuple) or name of the column of the dataframe in data containing the name of the layer on which to draw each line. Alternatively, it can be the name of a single layer on which all lines will be added. If the specified layer has not yet been created, oneworld will create an overlay with that name using the default settings (Default: “map”, which will add the lines directly to the map object).

  • style (dict) – Dictionary containing keywords and values defining common style values for all lines. Note that the ‘color’, ‘fillColor’ and ‘radius’ keywords defined in style will override those in the color and size parameters (Default: {‘opacity’:1.0, ‘fillOpacity’:0.6}).

  • style_mouseover (dict) – If set, style of a line when the mouse is hovered over it (Default: None).

  • info_mouseover (list or tuple or str) – If set, sequence (list or tuple) or name of the column of the dataframe in data containing the information to be displayed on a pannel when the mouse is hovered over the line. Accepts html format (Default: None).

  • legend_pos ({'topleft', 'topright', 'bottomleft', 'bottomright'}) – Only relevant when color is not a str corresponding to a hex color. Position of the color legend, or None for no legend (Default: “bottomright”).

  • legend_ndec (int) – Only relevant when color is not a str corresponding to a hex color. Number of decimal places to be displayed on the color legend (Default: 2)

Notes

For available color palettes, see https://seaborn.pydata.org/tutorial/color_palettes.html

For a full listing of style options, see https://leafletjs.com/reference-1.6.0.html#path