Skip to content

Cannot pass linewidths to plot_kde #2473

@davipatti

Description

@davipatti

Describe the bug

Passing linewidths to contour_kwargs does not affect contour linewidths.

To Reproduce

import arviz as az

idata = az.load_arviz_data('non_centered_eight')
az.plot_kde(idata.posterior["mu"], idata.posterior["tau"], contour_kwargs=dict(linewidths=0))
Image

A UserWarning is raised:

.../python3.13/site-packages/arviz/plots/backends/matplotlib/kdeplot.py:166: UserWarning: The following kwargs were not used by contour: 'linewidth'
  ax.contour(x_x, y_y, density, **contour_kwargs)

Updating plt.rcParams["lines.linewidth"] does affect linewidths.

From the UserWarning it looks like linewidths may be being updated to linewidth, but contour expects linewidths

Expected behavior

Linewidths to be passed to matplotlib contour.

Additional context

arviz 0.22.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions