Skip to content Skip to sidebar Skip to footer

Using Matplotlib, How Do I Whiten The Background Of The Axis Label?

Is there a way to whiten out the background of the axis label so that when it crosses the axis line itself, the latter does not run through it? For example, this script (the best

Solution 1:

By default, the left spine has a zorder of 2.5. For some reason this seems to cause problems; maybe there's something in the code which only works if they're integral? Anyway, if you add

ax.spines['left'].set_zorder(2)

or more generally

ax.spines['left'].set_zorder(ax.yaxis.get_label().get_zorder()-1)

before the show, it should work. Also, set_ylabel returns the ylab object itself, so if you use "ylab = ax.set_ylabel(stuff)" you can avoid all the ax.yaxis.get_label() calls later.

example of box dominating spine

Solution 2:

Does this link help you? http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels You can simply shift the y-axis to the right to allows some space for the $S(\mathbf{Q})L^{1+\eta}$ mark be fully placed before the axis line.

Post a Comment for "Using Matplotlib, How Do I Whiten The Background Of The Axis Label?"