dfm / dfm/corner.py

Setting Grid (axes) Below Not Properly Functional

Open
#287 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

I am making a corner plot, as so:

fig = corner.corner(
    flat_samples,
    range=[(120, 440), (0.845, 0.853), (0.018, 0.044), (3, 6.6), (0.015, 0.028)],
    quantiles=(0.16, 0.84),
    labels=labels,
    verbose=True,
    color=colors["gray"],
)
ax = np.array(fig.axes).reshape((ndim, ndim))

for i in range(len(ax)):
    for j in range(len(ax)):
        ax[i, j].grid(which="major", color="#CCCCCC")
        # ax[i, j].set_axisbelow(True)
plt.rc("axes", axisbelow=True)

plt.show()

Image

I have also tried the commented out method in order to add gridlines but set them below the data, however the gridlines simply stay above the data. When I make corner plots or plots in general manually, this seems to be entirely functional, so I am opening the issue here. In case its a matplotlib issue, I can open an issue on their github as well, however I am not well versed in the implementation in corner to know the full details of why this is not working here.

Also, not sure if this is a thing, but an option to include the horizontal grid lines on histograms would be nice also, but that is a separate issue. Tick labels on hists would be great but would probably make the resulting figure look cramped based on the style of corner's cornerplots. Could probably figure it out with hist kwargs though, haven't tried it yet.

If anything else is needed, happy to share. I left out some information about the data itself, this is for an assignment and I'm not sure the professor would take kindly to the answer plot being publicly shared lol.

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 by reproducing the provided Python corner.corner example, focusing on ax[i, j].grid(...) and set_axisbelow(True). Inspect how corner.py creates and configures its axes, then verify that gridlines render below plotted data; the histogram horizontal-grid request is separate.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.