(
        display_toolbar=True, display_errors=True, zoom_level=None, tilt=45,
        center=None, layout=None, map_type='ROADMAP',
        mouse_handling='COOPERATIVE')
return fig
Create a gmaps figure

    This returns a `Figure` object to which you can add data layers.

    :param display_toolbar:
        Boolean denoting whether to show the toolbar. Defaults to True.
    :type display_toolbar: boolean, optional

    :param display_errors:
        Boolean denoting whether to show errors that arise in the client.
        Defaults to True.
    :type display_errors: boolean, optional

    :param zoom_level:
        Integer between 0 and 21 indicating the initial zoom level.
        High values are more zoomed in.
        By default, the zoom level is chosen to fit the data passed to the
        map. If specified, you must also specify the map center.
    :type zoom_level: int, optional

    :param tilt:
        Tilt can be either 0 or 45 indicating the tilt angle in
        degrees.  45-degree imagery is only available for satellite
        and hybrid map types, and is not available at every location
        at every zoom level. For locations where 45-degree imagery is
        not available, Google Maps will automatically fall back to 0
        tilt.
    :type tilt: int, optional

    :param center:
        Latitude-longitude pair determining the map center.
        By default, the map center is chosen to fit the data passed to the
        map. If specified, you must also specify the zoom level.
    :type center: tuple, optional

    {map_type}

    {mouse_handling}

    :param layout:
        Control the layout of the figure, e.g. its width, height, border etc.
        For instance, passing ``layout={{'width': '400px', 'height': '300px'}}``
        will build a figure of fixed width and height.
        For more in formation on available properties, see the ipywidgets
        documentation on
        `widget layout <https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Styling.html#The-layout-attribute>`_.
    :type layout: dict, optional

    :returns:
        A :class:`gmaps.Figure` widget.

    :Examples:

    >>> import gmaps
    >>> gmaps.configure(api_key="AI...")
    >>> fig = gmaps.figure()
    >>> locations = [(46.1, 5.2), (46.2, 5.3), (46.3, 5.4)]
    >>> fig.add_layer(gmaps.heatmap_layer(locations))

    You can also explicitly specify the intiial map center and zoom:

    >>> fig = gmaps.figure(center=(46.0, -5.0), zoom_level=8)

    To customise the layout:

    >>> fig = gmaps.figure(layout={{
            'width': '400px',
            'height': '600px',
            'padding': '3px',
            'border': '1px solid black'
    }})

    To have a satellite map:

    >>> fig = gmaps.figure(map_type='HYBRID')
Create a gmaps figure
Create a gmaps figure
def figure(
        display_toolbar=True, display_errors=True, zoom_level=None, tilt=45,
        center=None, layout=None, map_type='ROADMAP',
        mouse_handling='COOPERATIVE'):
    """
    Create a gmaps figure

    This returns a `Figure` object to which you can add data layers.

    :param display_toolbar:
        Boolean denoting whether to show the toolbar. Defaults to True.
    :type display_toolbar: boolean, optional

    :param display_errors:
        Boolean denoting whether to show errors that arise in the client.
        Defaults to True.
    :type display_errors: boolean, optional

    :param zoom_level:
        Integer between 0 and 21 indicating the initial zoom level.
        High values are more zoomed in.
        By default, the zoom level is chosen to fit the data passed to the
        map. If specified, you must also specify the map center.
    :type zoom_level: int, optional

    :param tilt:
        Tilt can be either 0 or 45 indicating the tilt angle in
        degrees.  45-degree imagery is only available for satellite
        and hybrid map types, and is not available at every location
        at every zoom level. For locations where 45-degree imagery is
        not available, Google Maps will automatically fall back to 0
        tilt.
    :type tilt: int, optional

    :param center:
        Latitude-longitude pair determining the map center.
        By default, the map center is chosen to fit the data passed to the
        map. If specified, you must also specify the zoom level.
    :type center: tuple, optional

    {map_type}

    {mouse_handling}

    :param layout:
        Control the layout of the figure, e.g. its width, height, border etc.
        For instance, passing ``layout={{'width': '400px', 'height': '300px'}}``
        will build a figure of fixed width and height.
        For more in formation on available properties, see the ipywidgets
        documentation on
        `widget layout <https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Styling.html#The-layout-attribute>`_.
    :type layout: dict, optional

    :returns:
        A :class:`gmaps.Figure` widget.

    :Examples:

    >>> import gmaps
    >>> gmaps.configure(api_key="AI...")
    >>> fig = gmaps.figure()
    >>> locations = [(46.1, 5.2), (46.2, 5.3), (46.3, 5.4)]
    >>> fig.add_layer(gmaps.heatmap_layer(locations))

    You can also explicitly specify the intiial map center and zoom:

    >>> fig = gmaps.figure(center=(46.0, -5.0), zoom_level=8)

    To customise the layout:

    >>> fig = gmaps.figure(layout={{
            'width': '400px',
            'height': '600px',
            'padding': '3px',
            'border': '1px solid black'
    }})

    To have a satellite map:

    >>> fig = gmaps.figure(map_type='HYBRID')

    """  # noqa: E501
    if zoom_level is not None or center is not None:
        if zoom_level is None or center is None:
            raise ValueError(
                "Either both zoom_level and center "
                "should be specified, or neither"
            )
        else:
            initial_viewport = InitialViewport.from_zoom_center(
                    zoom_level, center)
    else:
        initial_viewport = InitialViewport.from_data_bounds()

    # set map to occupy entire space allowed by figure
    _map = Map(
        initial_viewport=initial_viewport,
        layout=widgets.Layout(width='100%', height='100%')
    )

    _toolbar = Toolbar() if display_toolbar else None
    _errors_box = ErrorsBox() if display_errors else None
    fig = Figure(
        _map=_map, _toolbar=_toolbar, _errors_box=_errors_box,
        layout=layout, map_type=map_type, tilt=tilt,
        mouse_handling=mouse_handling)
    return fig
def figure ( display_toolbar = True , display_errors = True , zoom_level = None , tilt = 45 , center = None , layout = None , map_type = 'ROADMAP' , mouse_handling = 'COOPERATIVE' ) : # noqa: E501 if zoom_level is not None or center is not None : if zoom_level is None or center is None : raise ValueError ( "Either both zoom_level and center " "should be specified, or neither" ) else : initial_viewport = InitialViewport . from_zoom_center ( zoom_level , center ) else : initial_viewport = InitialViewport . from_data_bounds ( ) # set map to occupy entire space allowed by figure _map = Map ( initial_viewport = initial_viewport , layout = widgets . Layout ( width = '100%' , height = '100%' ) ) _toolbar = Toolbar ( ) if display_toolbar else None _errors_box = ErrorsBox ( ) if display_errors else None fig = Figure ( _map = _map , _toolbar = _toolbar , _errors_box = _errors_box , layout = layout , map_type = map_type , tilt = tilt , mouse_handling = mouse_handling ) return fig