Exemplo n.º 1
0
    raise chart.ChartScriptError("The result filter returned no data.")

title, legend = utils.extract_label_columns(df)

df.sort_values(by=[l for i, l in legend], axis='index', inplace=True)

# This is how much of the standard deviation will give the 25th and 75th
# percentiles, assuming normal distribution.
# >>> math.sqrt(2) * scipy.special.erfinv(0.5)
coeff = 0.6744897501960817

boxes = [(r.min, r.mean - r.stddev * coeff, r.mean, r.mean + r.stddev * coeff,
          r.max) for r in df.itertuples(index=False) if r.count > 0]
labels = [
    ", ".join([getattr(r, l[1]) for l in legend])
    for r in df.itertuples(index=False) if r.count > 0
]
utils.customized_box_plot(boxes, labels)

title = utils.make_chart_title(df, title, legend)
if "title" in props and props["title"]:
    title = props["title"]
utils.set_plot_title(title)

plt.tight_layout()

utils.postconfigure_plot(props)

utils.export_image_if_needed(props)
utils.export_data_if_needed(df, props)
Exemplo n.º 2
0
title, legend = utils.extract_label_columns(df)

df.sort_values(by=[l for i, l in legend], axis='index', inplace=True)

ax = plt.gca()

# This is how much of the standard deviation will give the 25th and 75th
# percentiles, assuming normal distribution.
# >>> math.sqrt(2) * scipy.special.erfinv(0.5)
coeff = 0.6744897501960817

boxes = [(r.min, r.mean - r.stddev * coeff, r.mean, r.mean + r.stddev * coeff,
          r.max) for r in df.itertuples(index=False) if r.count > 0]
utils.customized_box_plot(boxes, ax)

utils.set_plot_title(utils.make_chart_title(df, title, legend))

ax.set_xticklabels([
    utils.make_legend_label(legend, r) for r in df.itertuples(index=False)
    if r.count > 0
])

utils.make_fancy_xticklabels(ax)

plt.tight_layout()

utils.postconfigure_plot(props)

utils.export_image_if_needed(props)
utils.export_data_if_needed(df, props)
Exemplo n.º 3
0
    df, [xaxis_itervar],
    "The iteration variable for the X axis could not be found")
utils.assert_columns_exist(
    df, [yaxis_itervar],
    "The iteration variable for the Y axis could not be found")

if xaxis_itervar == yaxis_itervar:
    raise chart.ChartScriptError(
        "The itervar for the X and Y axes are the same: " + xaxis_itervar)

df[xaxis_itervar] = pd.to_numeric(df[xaxis_itervar], errors="ignore")
df[yaxis_itervar] = pd.to_numeric(df[yaxis_itervar], errors="ignore")

title_cols, legend_cols = utils.extract_label_columns(df, props)

title = utils.make_chart_title(df, title_cols)

unique_names = df["name"].unique()

if len(unique_names) != 1:
    raise chart.ChartScriptError("Selected scalars must share the same name.")

scalar_name = unique_names[0]

df = pd.pivot_table(df,
                    columns=[xaxis_itervar],
                    index=yaxis_itervar,
                    values="value",
                    dropna=False)

ax = plt.gcf().add_subplot(111, projection='3d')