class_docstr: Figure widget
  
  This is the base widget for a Figure. Prefer instantiating
  instances of ``Figure`` using the :func:`gmaps.figure`
  factory method.
class_docstr_tok: ["Figure","widget","This","is","the","base","widget","for","a","Figure",".","Prefer","instantiating","instances","of","``","Figure","``","using","the",":","func",":","`","gmaps.figure","`","factory","method","."]
docstr: Add a data layer to this figure.
  
  :param layer: a `gmaps` layer.
  
  :Examples:
  
  >>> f = figure()
  >>> fig.add_layer(gmaps.heatmap_layer(locations))
  
  .. seealso:: layer creation functions
  
      :func:`gmaps.heatmap_layer`
          Create a heatmap layer
  
      :func:`gmaps.symbol_layer`
          Create a layer of symbols
  
      :func:`gmaps.marker_layer`
          Create a layer of markers
  
      :func:`gmaps.geojson_layer`
          Create a GeoJSON layer
  
      :func:`gmaps.drawing_layer`
          Create a layer of custom features, and allow users to draw
          on the map
  
      :func:`gmaps.directions_layer`
          Create a layer with directions
  
      :func:`gmaps.bicycling_layer`
          Create a layer showing cycle routes
  
      :func:`gmaps.transit_layer`
          Create a layer showing public transport
  
      :func:`gmaps.traffic_layer`
          Create a layer showing current traffic information
docstr_tok: ["Add","a","data","layer","to","this","figure",".",":","param","layer",":","a","`","gmaps","`","layer",".",":","Examples",":",">",">",">","f","=","figure","(",")",">",">",">","fig.add_layer","(","gmaps.heatmap_layer","(","locations",")",")","..","seealso",":",":","layer","creation","functions",":","func",":","`","gmaps.heatmap_layer","`","Create","a","heatmap","layer",":","func",":","`","gmaps.symbol_layer","`","Create","a","layer","of","symbols",":","func",":","`","gmaps.marker_layer","`","Create","a","layer","of","markers",":","func",":","`","gmaps.geojson_layer","`","Create","a","GeoJSON","layer",":","func",":","`","gmaps.drawing_layer","`","Create","a","layer","of","custom","features",",","and","allow","users","to","draw","on","the","map",":","func",":","`","gmaps.directions_layer","`","Create","a","layer","with","directions",":","func",":","`","gmaps.bicycling_layer","`","Create","a","layer","showing","cycle","routes",":","func",":","`","gmaps.transit_layer","`","Create","a","layer","showing","public","transport",":","func",":","`","gmaps.traffic_layer","`","Create","a","layer","showing","current","traffic","information"]
code: def add_layer(self, layer):
      """
      Add a data layer to this figure.
  
      :param layer: a `gmaps` layer.
  
      :Examples:
  
      >>> f = figure()
      >>> fig.add_layer(gmaps.heatmap_layer(locations))
  
      .. seealso:: layer creation functions
  
          :func:`gmaps.heatmap_layer`
              Create a heatmap layer
  
          :func:`gmaps.symbol_layer`
              Create a layer of symbols
  
          :func:`gmaps.marker_layer`
              Create a layer of markers
  
          :func:`gmaps.geojson_layer`
              Create a GeoJSON layer
  
          :func:`gmaps.drawing_layer`
              Create a layer of custom features, and allow users to draw
              on the map
  
          :func:`gmaps.directions_layer`
              Create a layer with directions
  
          :func:`gmaps.bicycling_layer`
              Create a layer showing cycle routes
  
          :func:`gmaps.transit_layer`
              Create a layer showing public transport
  
          :func:`gmaps.traffic_layer`
              Create a layer showing current traffic information
      """
      try:
          toolbar_controls = layer.toolbar_controls
          if self._toolbar is not None and toolbar_controls is not None:
              self._toolbar.add_controls(toolbar_controls)
      except AttributeError:
          pass
      self._map.add_layer(layer)
  
file_path: gmaps/gmaps/figure.py
imports: import ipywidgets
  from traitlets import Unicode, Instance, default, link
  from .maps import Map, InitialViewport, GMapsWidgetMixin, map_params_doc_snippets
  from .geotraitlets import MapType, MouseHandling, Tilt
  from .toolbar import Toolbar
  from .errors_box import ErrorsBox
  from ._docutils import doc_subst
label_desc: Use image node_id 3 for calling the Figure obj's underlying member method code with example usage: obj.add_layer(layer) without return types