def factorplot(x=None, y=None, hue=None, data=None, row=None, col=None,
               col_wrap=None, estimator=np.mean, ci=95, n_boot=1000,
               units=None, order=None, hue_order=None, row_order=None,
               col_order=None, kind="point", size=4, aspect=1,
               orient=None, color=None, palette=None,
               legend=True, legend_out=True, sharex=True, sharey=True,
               margin_titles=False, facet_kws=None, **kwargs):

    # Handle some deprecated arguments
    if "hline" in kwargs:
        kwargs.pop("hline")
        warnings.warn("The `hline` parameter has been removed", UserWarning)

    if "dropna" in kwargs:
        kwargs.pop("dropna")
        warnings.warn("The `dropna` parameter has been removed", UserWarning)

    if "x_order" in kwargs:
        order = kwargs.pop("x_order")
        warnings.warn("The `x_order` parameter has been renamed `order`",
                      UserWarning)

    # Determine the plotting function
    try:
        plot_func = globals()[kind + "plot"]
    except __HOLE__:
        err = "Plot kind '{}' is not recognized".format(kind)
        raise ValueError(err)

    # Alias the input variables to determine categorical order and palette
    # correctly in the case of a count plot
    if kind == "count":
        if x is None and y is not None:
            x_, y_, orient = y, y, "h"
        elif y is None and x is not None:
            x_, y_, orient = x, x, "v"
        else:
            raise ValueError("Either `x` or `y` must be None for count plots")
    else:
        x_, y_ = x, y

    # Determine the order for the whole dataset, which will be used in all
    # facets to ensure representation of all data in the final plot
    p = _CategoricalPlotter()
    p.establish_variables(x_, y_, hue, data, orient, order, hue_order)
    order = p.group_names
    hue_order = p.hue_names

    # Determine the palette to use
    # (FacetGrid will pass a value for ``color`` to the plotting function
    # so we need to define ``palette`` to get default behavior for the
    # categorical functions
    p.establish_colors(color, palette, 1)
    if kind != "point" or hue is not None:
        palette = p.colors

    # Determine keyword arguments for the facets
    facet_kws = {} if facet_kws is None else facet_kws
    facet_kws.update(
        data=data, row=row, col=col,
        row_order=row_order, col_order=col_order,
        col_wrap=col_wrap, size=size, aspect=aspect,
        sharex=sharex, sharey=sharey,
        legend_out=legend_out, margin_titles=margin_titles,
        dropna=False,
        )

    # Determine keyword arguments for the plotting function
    plot_kws = dict(
        order=order, hue_order=hue_order,
        orient=orient, color=color, palette=palette,
        )
    plot_kws.update(kwargs)

    if kind in ["bar", "point"]:
        plot_kws.update(
            estimator=estimator, ci=ci, n_boot=n_boot, units=units,
            )

    # Initialize the facets
    g = FacetGrid(**facet_kws)

    # Draw the plot onto the facets
    g.map_dataframe(plot_func, x, y, hue, **plot_kws)

    # Special case axis labels for a count type plot
    if kind == "count":
        if x is None:
            g.set_axis_labels(x_var="count")
        if y is None:
            g.set_axis_labels(y_var="count")

    if legend and (hue is not None) and (hue not in [x, row, col]):
        hue_order = list(map(str, hue_order))
        g.add_legend(title=hue, label_order=hue_order)

    return g
dataset/ETHPy150Open mwaskom/seaborn/seaborn/categorical.py/factorplot