Exemple #1
0
def barh(x, labels=None, fig=None, **kwargs):
    kwargs.update({"xlabel": get_label(x)})

    fig, show = check_fig(fig, **kwargs)

    fig.barh(x, labels=labels, **kwargs)

    return return_plt(fig, show, **kwargs)
Exemple #2
0
def plot(x, y, fig=None, **kwargs):
    x_label, y_label = get_label(x), get_label(y)

    if isinstance(y_label, list):  # multi label goes into legend
        if kwargs.get("label") is None:
            kwargs.update({"label": y_label})
    elif isinstance(y_label, str):  # single label goes into axis labels
        if kwargs.get("ylabel") is None:
            kwargs.update({"ylabel": y_label})
        if kwargs.get("xlabel") is None:
            kwargs.update({"xlabel": x_label})

    fig, show = check_fig(fig, **kwargs)

    fig.plot(x, y, **kwargs)

    return return_plt(fig, show, **kwargs)
Exemple #3
0
def boxplot(x, labels=None, fig=None, **kwargs):
    if labels is None:
        labels = get_label(x)

    fig, show = check_fig(fig, **kwargs)

    fig.boxplot(x, labels=labels, **kwargs)

    return return_plt(fig, show, **kwargs)
Exemple #4
0
def hist(x, bins=10, fig=None, **kwargs):
    if kwargs.get("xlabel") is None:
        kwargs.update({"xlabel": get_label(x)})
    if kwargs.get("ylabel") is None:
        kwargs.update({"ylabel": "counts"})

    fig, show = check_fig(fig, **kwargs)

    fig.hist(x, bins=bins, **kwargs)

    return return_plt(fig, show, **kwargs)
Exemple #5
0
def test_get_label(x, expected_label):
    label = get_label(x)
    assert label == expected_label