Pythonic way of checking for dict keys
Both ways are valid and have their own advantages. Checking upfront using an if statement involve a bit of overheard for each usage, using EAFP involve greater overheads but only for the "wrong" case.

So if you mostly have cases where 'y' is in self.axes then EAFP is better, otherwise LBYL is fine.

But if you only are calling this pattern a handful of times, then either will do; or no, use the third approach contextlib.suppress because this except: pass is ugly:

from contextlib import suppress


with suppress(KeyError):
    ax = self.axes['y'].ax
    coord1[ax] = x0
    coord2[ax] = (y1) - height[ax]
    coord3[ax] = x0 + width[ax]
    coord4[ax] = y1