Skip to content

contour ignores lw argument, no warning/error #13848

Open
@lzkelley

Description

@lzkelley

Bug report

The command contour does not use lw arguments (unlike, e.g., plot), and does not report an error or warning. The linewidths argument works fine. A simple fix is to explicitly look for lw arguments and set linewidths to that. Happy to put in a PR for this, but I wanted to check first.

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
print(mpl.__version__)

fig, axes = plt.subplots(ncols=3)

for ax, lw, arg in zip(axes, [1.0, 4.0, 4.0], ['lw', 'lw', 'linewidths']):
    aa = np.random.normal(size=1000)
    bb = np.random.normal(size=aa.size)
    hist, xe, ye = np.histogram2d(aa, bb)
    kw = {arg: lw}
    ax.contour(hist, **kw)
    ax.set_title('{}: {}'.format(arg, lw))

plt.show()

Actual outcome

mpl

Matplotlib version

  • Matplotlib version: 3.0.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions