

def plot_tfr_topomap(tfr, tmin=None, tmax=None, fmin=None, fmax=None, ch_type=None, baseline=None, mode='mean', layout=None, vmin=None, vmax=None, cmap=None, sensors=True, colorbar=True, unit=None, res=64, size=2, cbar_fmt='%1.1e', show_names=False, title=None, axes=None, show=True, outlines='head', head_pos=None):
    'Plot topographic maps of specific time-frequency intervals of TFR data\n\n    Parameters\n    ----------\n    tfr : AvereageTFR\n        The AvereageTFR object.\n    tmin : None | float\n        The first time instant to display. If None the first time point\n        available is used.\n    tmax : None | float\n        The last time instant to display. If None the last time point\n        available is used.\n    fmin : None | float\n        The first frequency to display. If None the first frequency\n        available is used.\n    fmax : None | float\n        The last frequency to display. If None the last frequency\n        available is used.\n    ch_type : \'mag\' | \'grad\' | \'planar1\' | \'planar2\' | \'eeg\' | None\n        The channel type to plot. For \'grad\', the gradiometers are\n        collected in pairs and the RMS for each pair is plotted.\n        If None, then channels are chosen in the order given above.\n    baseline : tuple or list of length 2\n        The time interval to apply rescaling / baseline correction.\n        If None do not apply it. If baseline is (a, b)\n        the interval is between "a (s)" and "b (s)".\n        If a is None the beginning of the data is used\n        and if b is None then b is set to the end of the interval.\n        If baseline is equal to (None, None) all the time\n        interval is used.\n    mode : \'logratio\' | \'ratio\' | \'zscore\' | \'mean\' | \'percent\'\n        Do baseline correction with ratio (power is divided by mean\n        power during baseline) or z-score (power is divided by standard\n        deviation of power during baseline after subtracting the mean,\n        power = [power - mean(power_baseline)] / std(power_baseline))\n        If None, baseline no correction will be performed.\n    layout : None | Layout\n        Layout instance specifying sensor positions (does not need to\n        be specified for Neuromag data). If possible, the correct layout\n        file is inferred from the data; if no appropriate layout file\n        was found, the layout is automatically generated from the sensor\n        locations.\n    vmin : float | callable | None\n        The value specifying the lower bound of the color range.\n        If None, and vmax is None, -vmax is used. Else np.min(data) or in case\n        data contains only positive values 0. If callable, the output equals\n        vmin(data). Defaults to None.\n    vmax : float | callable | None\n        The value specifying the upper bound of the color range. If None, the\n        maximum value is used. If callable, the output equals vmax(data).\n        Defaults to None.\n    cmap : matplotlib colormap | None\n        Colormap. If None and the plotted data is all positive, defaults to\n        \'Reds\'. If None and data contains also negative values, defaults to\n        \'RdBu_r\'. Defaults to None.\n    sensors : bool | str\n        Add markers for sensor locations to the plot. Accepts matplotlib\n        plot format string (e.g., \'r+\' for red plusses). If True, a circle will\n        be used (via .add_artist). Defaults to True.\n    colorbar : bool\n        Plot a colorbar.\n    unit : str | None\n        The unit of the channel type used for colorbar labels.\n    res : int\n        The resolution of the topomap image (n pixels along each side).\n    size : float\n        Side length per topomap in inches.\n    cbar_fmt : str\n        String format for colorbar values.\n    show_names : bool | callable\n        If True, show channel names on top of the map. If a callable is\n        passed, channel names will be formatted using the callable; e.g., to\n        delete the prefix \'MEG \' from all channel names, pass the function\n        lambda x: x.replace(\'MEG \', \'\'). If `mask` is not None, only\n        significant sensors will be shown.\n    title : str | None\n        Title. If None (default), no title is displayed.\n    axes : instance of Axis | None\n        The axes to plot to. If None the axes is defined automatically.\n    show : bool\n        Show figure if True.\n    outlines : \'head\' | \'skirt\' | dict | None\n        The outlines to be drawn. If \'head\', the default head scheme will be\n        drawn. If \'skirt\' the head scheme will be drawn, but sensors are\n        allowed to be plotted outside of the head circle. If dict, each key\n        refers to a tuple of x and y positions, the values in \'mask_pos\' will\n        serve as image mask, and the \'autoshrink\' (bool) field will trigger\n        automated shrinking of the positions due to points outside the outline.\n        Alternatively, a matplotlib patch object can be passed for advanced\n        masking options, either directly or as a function that returns patches\n        (required for multi-axis plots). If None, nothing will be drawn.\n        Defaults to \'head\'.\n    head_pos : dict | None\n        If None (default), the sensors are positioned such that they span\n        the head circle. If dict, can have entries \'center\' (tuple) and\n        \'scale\' (tuple) for what the center and scale of the head should be\n        relative to the electrode locations.\n\n    Returns\n    -------\n    fig : matplotlib.figure.Figure\n        The figure containing the topography.\n    '
    from ..channels import _get_ch_type
    ch_type = _get_ch_type(tfr, ch_type)
    import matplotlib.pyplot as plt
    from mpl_toolkits.axes_grid1 import make_axes_locatable
    (picks, pos, merge_grads, names, _) = _prepare_topo_plot(tfr, ch_type, layout)
    if (not show_names):
        names = None
    data = tfr.data
    data = rescale(data, tfr.times, baseline, mode, copy=True)
    (itmin, itmax) = (None, None)
    idx = np.where(_time_mask(tfr.times, tmin, tmax))[0]
    if (tmin is not None):
        itmin = idx[0]
    if (tmax is not None):
        itmax = (idx[(- 1)] + 1)
    (ifmin, ifmax) = (None, None)
    idx = np.where(_time_mask(tfr.freqs, fmin, fmax))[0]
    if (fmin is not None):
        ifmin = idx[0]
    if (fmax is not None):
        ifmax = (idx[(- 1)] + 1)
    data = data[picks, ifmin:ifmax, itmin:itmax]
    data = np.mean(np.mean(data, axis=2), axis=1)[:, np.newaxis]
    if merge_grads:
        from ..channels.layout import _merge_grad_data
        data = _merge_grad_data(data)
    norm = (False if (np.min(data) < 0) else True)
    (vmin, vmax) = _setup_vmin_vmax(data, vmin, vmax, norm)
    if (cmap is None):
        cmap = ('Reds' if norm else 'RdBu_r')
    if (axes is None):
        fig = plt.figure()
        ax = fig.gca()
    else:
        fig = axes.figure
        ax = axes
    _hide_frame(ax)
    if (title is not None):
        ax.set_title(title)
    fig_wrapper = list()
    selection_callback = partial(_onselect, tfr=tfr, pos=pos, ch_type=ch_type, itmin=itmin, itmax=itmax, ifmin=ifmin, ifmax=ifmax, cmap=cmap, fig=title, layout=layout)
    (im, _) = plot_topomap(data[:, 0], pos, vmin=vmin, vmax=vmax, axes=ax, cmap=cmap, image_interp='bilinear', contours=False, names=names, show_names=show_names, show=False, onselect=selection_callback)
    if colorbar:
        divider = make_axes_locatable(ax)
        cax = divider.append_axes('right', size='5%', pad=0.05)
        cbar = plt.colorbar(im, cax=cax, format=cbar_fmt, cmap=cmap)
        cbar.set_ticks((vmin, vmax))
        cbar.ax.tick_params(labelsize=12)
        cbar.ax.set_title('AU')
    plt_show(show)
    return fig

dataset/ETHPy150Open mne-tools/mne-python/mne/viz/topomap.py plot_tfr_topomap/VarMisuse@577/2752 `fig_wrapper`->`title`