def spine_and_ticks(ax, reverted=False, thousands=False): if reverted: ax.spines['top'].set_color('none') ax.spines['left'].set_color("none") #removes ticks ax.xaxis.set_ticks_position('bottom') ax.yaxis.set_ticks_position('right') else: ax.spines['top'].set_color('none') ax.spines['right'].set_color("none") #removes ticks ax.xaxis.set_ticks_position('bottom') ax.yaxis.set_ticks_position('left') if thousands: ax.get_xaxis().set_major_formatter( funfor(lambda x, p: format(int(x), ','))) ax.get_yaxis().set_major_formatter( funfor(lambda x, p: format(int(x), ',')))
def x_thousands_sep(ax=None): if ax is None: ax = plt.gca() ax.get_xaxis().set_major_formatter( funfor(lambda x, p: format(int(x), ','))) plt.tight_layout()