seaborn.pointplot

    A point plot represents an estimate of central tendency for a numeric variable by the position of scatter plot points and provides some indication of the uncertainty around that estimate using error bars.

    Point plots can be more useful than bar plots for focusing comparisons between different levels of one or more categorical variables. They are particularly adept at showing interactions: how the relationship between levels of one categorical variable changes across levels of a second categorical variable. The lines that join each point from the same level allow interactions to be judged by differences in slope, which is easier for the eyes than comparing the heights of several groups of points or bars.

    It is important to keep in mind that a point plot shows only the mean (or other estimator) value, but in many cases it may be more informative to show the distribution of values at each level of the categorical variables. In that case, other approaches such as a box or violin plot may be more appropriate.

    Input data can be passed in a variety of formats, including:

    • Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the x, y, and/or hue parameters.
    • A “long-form” DataFrame, in which case the x, y, and hue variables will determine how the data are plotted.
    • A “wide-form” DataFrame, such that each numeric column will be plotted.
    • An array or list of vectors.

    In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.

    This function always treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis, even when the data has a numeric or date type.

    See the for more information.

    参数:x, y, hue:names of variables in data or vector data, optional

    data:DataFrame, array, or list of arrays, optional

    Dataset for plotting. If x and y are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.

    order, hue_order:lists of strings, optional

    Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.

    estimator:callable that maps vector -> scalar, optional

    Statistical function to estimate within each categorical bin.

    ci:float or “sd” or None, optional

    Size of confidence intervals to draw around estimated values. If “sd”, skip bootstrapping and draw the standard deviation of the observations. If None, no bootstrapping will be performed, and error bars will not be drawn.

    n_boot:int, optional

    Number of bootstrap iterations to use when computing confidence intervals.

    units:name of variable in data or vector data, optional

    markers:string or list of strings, optional

    Markers to use for each of the hue levels.

    linestyles:string or list of strings, optional

    :bool or float, optional

    Amount to separate the points for each level of the hue variable along the categorical axis.

    join:bool, optional

    If True, lines will be drawn between point estimates at the same hue level.

    scale:float, optional

    Scale factor for the plot elements.

    orient:“v” | “h”, optional

    color:matplotlib color, optional

    Color for all of the elements, or seed for a gradient palette.

    palette:palette name, list, or dict, optional

    Colors to use for the different levels of the hue variable. Should be something that can be interpreted by color_palette(), or a dictionary mapping hue levels to matplotlib colors.

    errwidth:float, optional

    Thickness of error bar lines (and caps).

    capsize:float, optional

    Width of the “caps” on error bars.

    ax:matplotlib Axes, optional

    Axes object to draw the plot onto, otherwise uses the current Axes.

    返回值:ax:matplotlib Axes

    See also

    Show point estimates and confidence intervals using bars.Combine a categorical plot with a class:FacetGrid.

    Examples

    Draw a set of vertical point plots grouped by a categorical variable:

    1. >>> import seaborn as sns
    2. >>> sns.set(style="darkgrid")
    3. >>> tips = sns.load_dataset("tips")
    4. >>> ax = sns.pointplot(x="time", y="total_bill", data=tips)

    Draw a set of vertical points with nested grouping by a two variables:

    1. >>> ax = sns.pointplot(x="time", y="total_bill", hue="smoker",

    Separate the points for different hue levels along the categorical axis:

    1. >>> ax = sns.pointplot(x="time", y="total_bill", hue="smoker",
    2. ... data=tips, dodge=True)

    http://seaborn.pydata.org/_images/seaborn-pointplot-3.png

    Use a different marker and line style for the hue levels:

    1. ... data=tips,
    2. ... markers=["o", "x"],
    3. ... linestyles=["-", "--"])

    Draw a set of horizontal points:

    http://seaborn.pydata.org/_images/seaborn-pointplot-5.png

    Don’t draw a line connecting each point:

    1. >>> ax = sns.pointplot(x="tip", y="day", data=tips, join=False)

    Use a different color for a single-layer plot:

    1. >>> ax = sns.pointplot("time", y="total_bill", data=tips,
    2. ... color="#bb3f3f")

    http://seaborn.pydata.org/_images/seaborn-pointplot-7.png

    Use a different color palette for the points:

    1. ... data=tips, palette="Set2")

    Control point order by passing an explicit order:

    1. >>> ax = sns.pointplot(x="time", y="tip", data=tips,
    2. ... order=["Dinner", "Lunch"])

    http://seaborn.pydata.org/_images/seaborn-pointplot-9.png

    Use median as the estimate of central tendency:

    Show the standard error of the mean with the error bars:

    1. >>> ax = sns.pointplot(x="day", y="tip", data=tips, ci=68)

    http://seaborn.pydata.org/_images/seaborn-pointplot-11.png

    Show standard deviation of observations instead of a confidence interval:

    1. >>> ax = sns.pointplot(x="day", y="tip", data=tips, ci="sd")

    Add “caps” to the error bars:

    1. >>> ax = sns.pointplot(x="day", y="tip", data=tips, capsize=.2)

    http://seaborn.pydata.org/_images/seaborn-pointplot-13.png

    1. >>> g = sns.catplot(x="sex", y="total_bill",
    2. ... hue="smoker", col="time",
    3. ... data=tips, kind="point",