dfm / dfm/corner.py

linestyle argument in overlpot_points

Open
#254 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
576
Forks
234
PR merge metrics
No merged PRs in 30d

Description

OS: Ubuntu
Python Version: 3.9
Corner Version: v2.2.2

I've found a tiny, probably inconsequential bug in overplot_points related to passing the argument ls to change the linestyle

import corner
import numpy as np

ndim, nsamples = 2, 10000
np.random.seed(42)
samples = np.random.randn(ndim * nsamples).reshape([nsamples, ndim])
figure = corner.corner(samples)

val = np.mean(samples, axis=0)
corner.overplot_points(figure, val[None], ls="--")

This gives the error: TypeError: Got both 'ls' and 'linestyle', which are aliases of one another

I expected that this wouldn't give an error, and should be the same as calling replacing ls with linestyle in the call to overplot_points (which doesn't seem to affect the plot anyways).

I think the solution is to remove the line kwargs["linestyle"] = kwargs.pop("linestyle", "none") in the definition of overplot_points in src/corner/core.py. With this line gone, I no longer get this error and all tests are passed when running nox.

This is a small fix but I'd be happy to open a PR for it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/corner/core.py at the overplot_points definition, focusing on how linestyle-related keyword arguments are handled. Reproduce the reported call with ls="--", then run nox and confirm that overplot_points accepts the alias without raising the duplicate-alias TypeError and that the existing tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.