pytest-mpl icon indicating copy to clipboard operation
pytest-mpl copied to clipboard

Paramater `remove_text` in `mpl_image_compare` decorator does not remove axis labels

Open RNKuhns opened this issue 4 years ago • 0 comments

When choosing remove_text=True I would have assumed that the text for axis labels was removed along with the axis ticks and any titles. But it doesn't seem to do that.

The code uses remove_ticks_and_titles from matplotlib and that does not appear to remove the axis labels (See matplotlib documentation).

I'd propose updating the remove_text conditional as follows:


if remove_text:
    remove_ticks_and_titles(fig)
    for ax in fig.get_axes():
        ax.set_xlabel = ""
        ax.set_ylabel = ""

If this seems reasonable, I can submit a PR.

RNKuhns avatar May 16 '21 15:05 RNKuhns