qcodes/dataset/plotting.py
def _appropriate_kwargs(plottype: str,
                        colorbar_present: bool,
                        **kwargs: Any) -> Any:
    """
    NB: Only to be used inside :func"`plot_dataset`.

    Context manager to temporarily mutate the plotting kwargs to be appropriate
    for a specific plottype. This is helpful since :func:`plot_dataset` may have
    to generate different kinds of plots (e.g. heatmaps and line plots) and
    the user may want to specify kwargs only relevant to some of them
    (e.g. 'cmap', that line plots cannot consume). Those kwargs should then not
    be passed to all plots, which is what this contextmanager handles.

    Args:
        plottype: The plot type for which the kwargs should be adjusted
        colorbar_present: Is there a non-None colorbar in this plot iteration?
    """

    def linehandler(**kwargs: Any) -> Any:
        kwargs.pop('cmap', None)
        return kwargs

    def heatmaphandler(**kwargs: Any) -> Any:
        if not(colorbar_present) and 'cmap' not in kwargs:
            kwargs['cmap'] = qc.config.plotting.default_color_map
        return kwargs

    plot_handler_mapping = {'1D_line': linehandler,
                            '1D_point': linehandler,
                            '1D_bar': linehandler,
                            '2D_point': heatmaphandler,
                            '2D_grid': heatmaphandler,
                            '2D_scatter': heatmaphandler,
                            '2D_equidistant': heatmaphandler,
                            '2D_unknown': heatmaphandler}

    yield plot_handler_mapping[plottype](**kwargs.copy())

    NB: Only to be used inside :func"`plot_dataset`.

    Context manager to temporarily mutate the plotting kwargs to be appropriate
    for a specific plottype. This is helpful since :func:`plot_dataset` may have
    to generate different kinds of plots (e.g. heatmaps and line plots) and
    the user may want to specify kwargs only relevant to some of them
    (e.g. 'cmap', that line plots cannot consume). Those kwargs should then not
    be passed to all plots, which is what this contextmanager handles.

    Args:
        plottype: The plot type for which the kwargs should be adjusted
        colorbar_present: Is there a non-None colorbar in this plot iteration?
    
Only to be used inside :func"`plot_dataset`.
Context manager to temporarily mutate the plotting kwargs to be appropriate
for a specific plottype. This is helpful since :func:`plot_dataset` may have
to generate different kinds of plots  and
the user may want to specify kwargs only relevant to some of them
. Those kwargs should then not
be passed to all plots, which is what this contextmanager handles.
Only to be used inside : func " ` plot_dataset ` . Context manager to temporarily mutate the plotting kwargs to be appropriate for a specific plottype . This is helpful since : func : ` plot_dataset ` may have to generate different kinds of plots and the user may want to specify kwargs only relevant to some of them . Those kwargs should then not be passed to all plots which is what this contextmanager handles .
def _appropriate_kwargs(plottype: str,
                        colorbar_present: bool,
                        **kwargs: Any) -> Any:
    def linehandler(**kwargs: Any) -> Any:
        kwargs.pop('cmap', None)
        return kwargs
    def heatmaphandler(**kwargs: Any) -> Any:
        if not(colorbar_present) and 'cmap' not in kwargs:
            kwargs['cmap'] = qc.config.plotting.default_color_map
        return kwargs
    plot_handler_mapping = {'1D_line': linehandler,
                            '1D_point': linehandler,
                            '1D_bar': linehandler,
                            '2D_point': heatmaphandler,
                            '2D_grid': heatmaphandler,
                            '2D_scatter': heatmaphandler,
                            '2D_equidistant': heatmaphandler,
                            '2D_unknown': heatmaphandler}
    yield plot_handler_mapping[plottype](**kwargs.copy())
def _appropriate_kwargs ( plottype : str , colorbar_present : bool , ** kwargs : Any ) -> Any : def linehandler ( ** kwargs : Any ) -> Any : kwargs . pop ( 'cmap' , None ) return kwargs def heatmaphandler ( ** kwargs : Any ) -> Any : if not ( colorbar_present ) and 'cmap' not in kwargs : kwargs [ 'cmap' ] = qc . config . plotting . default_color_map return kwargs plot_handler_mapping = { '1D_line' : linehandler , '1D_point' : linehandler , '1D_bar' : linehandler , '2D_point' : heatmaphandler , '2D_grid' : heatmaphandler , '2D_scatter' : heatmaphandler , '2D_equidistant' : heatmaphandler , '2D_unknown' : heatmaphandler } yield plot_handler_mapping [ plottype ] ( ** kwargs . copy ( ) )
NB: Only to be used inside :func"`plot_dataset`.
NB : Only to be used inside : func " ` plot_dataset ` .
"""
    NB: Only to be used inside :func"`plot_dataset`.

    Context manager to temporarily mutate the plotting kwargs to be appropriate
    for a specific plottype. This is helpful since :func:`plot_dataset` may have
    to generate different kinds of plots (e.g. heatmaps and line plots) and
    the user may want to specify kwargs only relevant to some of them
    (e.g. 'cmap', that line plots cannot consume). Those kwargs should then not
    be passed to all plots, which is what this contextmanager handles.

    Args:
        plottype: The plot type for which the kwargs should be adjusted
        colorbar_present: Is there a non-None colorbar in this plot iteration?
    """
plottype
str
The plot type for which the kwargs should be adjusted
The plot type for which the kwargs should be adjusted
colorbar_present
bool
None
kwargs
Any