Matplotlib/Seaborn: Passing non-integers as three-element position specification is deprecated since 3.3

Viewed 3452

I don't understand this error message:

MatplotlibDeprecationWarning: Passing non-integers as three-element position specification is deprecated since 3.3 and will be removed two minor releases later.

Can you please give me a hint ?

FYI my (not executable) code is below

import seaborn as sns
import matplotlib.pyplot as plt

for p in ps:
    p_metrics = output_metrics.loc[output_metrics["p"] == p, :]
    g = sns.relplot(x="k", y="metric_value", col="metric_name", hue="ref/eval", style="ref/eval",
                    col_wrap=np.ceil(np.sqrt(len(metrics))), palette="muted", kind="line",
                    dashes=False, legend="full", facet_kws={"sharex": False, "sharey": False},
                    data=p_metrics, markers=self.filled_markers)

    g.savefig(f"plot_cat1_p={p}.png")
    if show:
        plt.show()
1 Answers

I think the problem is that col_wrap= is expecting an int and you are passing a float, try casting it to int: col_wrap=int(np.ceil(np.sqrt(len(metrics))))

Related