dfm / corner.py

Make some beautiful corner plots

Home Page:http://corner.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing label on first marginalisation

sebastian-schindler opened this issue · comments

The first marginalisation (1D plot) is missing the axis label ("label 1" as y axis on the upper left plot):
image
This is produced using the Getting started example with added labels argument:

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, labels=("label 1", "label 2"))

This could be achieved (but surely that's not the nicest way to do it) by adding a line to the handling of the special case of j == i:

for j, y in enumerate(xs):
[...]
    if j > i:
[...]
    elif j == i:
        # add y label here
        continue

Or rather, putting the axis labelling code up there in the first place.

This is the expected behavior! The y-axis on the top left plot isn't in units of "label 1" and I wouldn't expect it to have that label. If you feel that you want to identify that subplot, a good approach is to use titles (i.e. the title of the top left subplot would be "label 1").

Ah, I see now! I interpreted the labels more as a labelling of the column or row of plots, rather than an axis label. With that view in mind it seems weird that one is missing. But I can also understand the other point of view, and it makes sense that the default is to not have this label there.

One can add it easily on their own to the returned axes like so: (for reverse = False and labelpad = 0)

ax = figure.axes[0]
ax.set_ylabel("label 1")
ax.yaxis.set_label_coords(-0.3, 0.5)