def plot_ARD(kernel, filtering=None, legend=False, canvas=None, **kwargs):
    """
    If an ARD kernel is present, plot a bar representation using matplotlib

    :param fignum: figure number of the plot
    :param filtering: list of names, which to use for plotting ARD parameters.
                      Only kernels which match names in the list of names in filtering
                      will be used for plotting.
    :type filtering: list of names to use for ARD plot
    """
    Tango.reset()

    ard_params = np.atleast_2d(kernel.input_sensitivity(summarize=False))
    bottom = 0
    last_bottom = bottom

    x = np.arange(kernel._effective_input_dim)

    parts = []
    def visit(x):
        if (not isinstance(x, CombinationKernel)) and isinstance(x, Kern):
            parts.append(x)
    kernel.traverse(visit)

    if filtering is None:
        filtering = [k.name for k in parts]

    bars = []
    kwargs = update_not_existing_kwargs(kwargs, pl().defaults.ard)


    if canvas is None:
        canvas, kwargs = pl().new_canvas(xlim=(-.5, kernel._effective_input_dim-.5), xlabel='input dimension', ylabel='sensitivity', **kwargs)

    for i in range(ard_params.shape[0]):
        if parts[i].name in filtering:
            c = Tango.nextMedium()
            bars.append(pl().barplot(canvas, x,
                                     ard_params[i,:], color=c,
                                     label=parts[i].name,
                                     bottom=bottom, **kwargs))
            last_bottom = ard_params[i,:]
            bottom += last_bottom
        else:
            print("filtering out {}".format(parts[i].name))

    #add_bar_labels(fig, ax, [bars[-1]], bottom=bottom-last_bottom)

    return pl().add_to_canvas(canvas, bars, legend=legend)
dataset/ETHPy150Open SheffieldML/GPy/GPy/plotting/gpy_plot/kernel_plots.py/plot_ARD/original