import numpy from matplotlib import pyplot x=numpy.linspace(-3,3,50) y=2*x+1 pyplot.figure(num=1,figsize=(5,5)) pyplot.plot(x,y,linewidth=10,zorder=1) ax=pyplot.gca() ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') ax.xaxis.set_ticks_position('bottom') ax.spines['bottom'].set_position(('data',0)) ax.yaxis.set_ticks_position('left') ax.spines['left'].set_position(('data',0)) for label in ax.get_xticklabels()+ax.get_yticklabels(): label.set_fontsize(12) label.set_bbox(dict(facecolor='white', edgecolor='none', alpha=0.7)) pyplot.show()