Eric, it works if I do:
         return MultipleLocator.tick_values(self, vmin, vmax)[2:]

But not if I do as first suggested by you:
         return MultipleLocator.tick_values(self, vmin, vmax)[1:]

I don't understand this behaviour. It should be [1:]. I'll just set
the ticks manually. Seems to be the easiest thing. It would be
awesome, if MPL had the same behaviour as gnuplot, which allows me to
simply do:
set xtics <start>, <incr>

On Sat, Feb 14, 2015 at 7:09 PM, Eric Firing <efir...@hawaii.edu> wrote:
> 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
>

------------------------------------------------------------------------------
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