Axis limits when plot_datapoints = False
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 576
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
I usually prefer to set plot_datapoints = False when using corner. However, as is often the case with plotting results from sampling algorithms, the data can contain outliers that are well outside percentiles one would show. The issue is that while these outliers don't contribute to the percentile bounds, they are still used to set the axis limits for each 2D histogram. Ideally, if plot_datapoints = False, the contours drawn should instead be used to generate the axis limits. The code and figures below illustrates the issue. Even though the outlier inserted at (-10, -10) does not fall into the percentile regions, it still causes the axis limits to enclose it.
import numpy as np
import matplotlib.pyplot as plt
from corner import corner
# Generate noisy 2D Gaussian
npts = 10000
x = np.random.normal(0, 1, size = npts)
y = np.random.normal(0, 1, size = npts)
# Insert outlier
x = np.append(x, [-10])
y = np.append(y, [-10])
data = np.column_stack((x, y))
corner(data, plot_density = False, plot_datapoints = False)
plt.show()
Actual result:
Desired result:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the public corner() entry point and reproduce the issue with the Python example in the report, focusing on the plot_datapoints=False path and its 2D histogram axis limits. Compare the resulting figure with the desired behavior and add or update coverage if the repository provides relevant plotting tests; done means outliers outside the displayed contours no longer expand those limits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, numpy, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100