def removeRightTicks(ax=None): ax = ax or pb.gca() for (i, line) in enumerate(ax.get_yticklines()): if i % 2 == 1: # odd indices line.set_visible(False)