|
From: Eric F. <ef...@ha...> - 2015-02-14 19:09:41
|
On 2015/02/14 8:45 AM, Tommy Carstensen wrote: > Erik, that doesn't seem to work either. I tried this: > > import matplotlib.pyplot as plt > from matplotlib.ticker import MultipleLocator > class TrimmedMultipleLocator(MultipleLocator): > def tick_values(self, vmin, vmax): > return MultipleLocator.tick_values(self, vmin, vmax)[2:] > fig = plt.figure() > ax1 = fig.add_subplot(111) > ax1.xaxis.set_major_locator(TrimmedMultipleLocator(5)) > #xticks[0].label1.set_visible(False) > #xticks[-1].label1.set_visible(False) > #ax1.set_xticks(ax1.xaxis.get_major_ticks()[1:-1]) > ax1.plot(list(range(21))) > plt.show() Are you sure? I tried it, and it works for me. See attached script and output. Eric |