Skip to content

FacetGrid.map_dataframe passes disallowed keyword arguments to pointplot #3004

@desilinguist

Description

@desilinguist

My code that used to work perfectly fine with 0.11.0 breaks with the new 0.12.0 release. The code creates a FacetGrid and then applies pointplot() to each of the cells as follows:

...
g = sns.FacetGrid(df_fs, row="metric", col="learner_name",
                  hue="variable", height=2.5, aspect=1,
                  margin_titles=True, despine=True, sharex=False,
                  sharey=False, legend_out=False, palette="Set1")
g = g.map_dataframe(sns.pointplot, "training_set_size", "value",
                    scale=.5, ci=None)
...

The relevant traceback is as follows:

Traceback (most recent call last):
 ...
  File "/builds/EducationalTestingService/skll/skll/experiments/output.py", line 127, in generate_learning_curve_plots
    g = g.map_dataframe(sns.pointplot, "training_set_size", "value",
  File "/root/sklldev/lib/python3.8/site-packages/seaborn/axisgrid.py", line 819, in map_dataframe
    self._facet_plot(func, ax, args, kwargs)
  File "/root/sklldev/lib/python3.8/site-packages/seaborn/axisgrid.py", line 848, in _facet_plot
    func(*plot_args, **plot_kwargs)
TypeError: pointplot() got an unexpected keyword argument 'label'

Looking at the code for FaceGrid.map_dataframe, it does indeed create a label keyword argument which, I guess, causes the failure when pointplot() is called. From reading the release notes, it looks like this is because of this item

Removed the (previously-unused) option to pass additional keyword arguments to pointplot()

That keyword argument is created if hue is specified which I am not sure how to get around since I have multiple variables that I want to represent with different colors. If there's another way to achieve this, I'd really appreciate any guidance.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions