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

Attachment: test_loc.pdf
Description: Adobe PDF document

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, ax1 = plt.subplots()
ax1.xaxis.set_major_locator(TrimmedMultipleLocator(5))
ax1.plot(list(range(21)))

fig.savefig('test_loc.pdf')
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to