Issue 1:
When using custom formatters/locators, duplicate axis labels are produced if the the formatters are set for both major and minor labels. I.e, this code:

import matplotlib.pyplot as plt
from matplotlib import ticker

# Setup the figure
fig = plt.figure()
ax = fig.add_subplot(111)

# Setup a formatter (just returns the same label)
fmt = ticker.StrMethodFormatter("{x:}")
ax.xaxis.set_major_formatter(fmt)
ax.xaxis.set_minor_formatter(fmt)

# Setup a locator
loc = ticker.LinearLocator(9)
ax.xaxis.set_major_locator(loc)
ax.xaxis.set_minor_locator(loc)

# Rotate the labels, just to show that they are duplicated (one set of labels will get rotated, one will not)
for lab in ax.xaxis.get_ticklabels():
lab.set_rotation(45)

plt.draw()
plt.show()

Produces duplicate labels (note: The set_rotation is not needed to produce the duplicates, but just shows that they actually are duplicated!)

If I remove the call to set_minor_locator/formatter, the code works as expected:

import matplotlib.pyplot as plt
from matplotlib import ticker
fig = plt.figure()
ax = fig.add_subplot(111)
fmt = ticker.StrMethodFormatter("{x:}")
ax.xaxis.set_major_formatter(fmt)

loc = ticker.LinearLocator(9)
ax.xaxis.set_major_locator(loc)

for lab in ax.xaxis.get_ticklabels():
lab.set_rotation(45)

plt.draw()
plt.show()

I've been looking through the code for a day, but can't find anywhere where there is an obvious error and I don't think I am doing anything particularly unusual in my code...

Any idea what might be causing this?

As far as I can tell, in order to produce this behaviour you need to set both a formatter and a locator. I've only tested with the formatter/locator classes given in the code above so far.

Issue 2:
Bug report

Bug summary

I generated a very large dotplot (figsize=(100,10)), but it only shows partial x-axis.

Code for reproduction

#!/usr/bin/env python

import matplotlib
matplotlib.use('Agg') # To solve remote session issues
import matplotlib.pyplot as plt
import sys, subprocess

depth_file = sys.argv[1]

window = int(100e3)
total_job = int(subprocess.check_output(['wc', '-l', depth_file]).split(' ')[0])

plt.figure(figsize=(100,10), dpi=600)
tick = int(10e6) # ticks interval: 10 Mb
x, y = [], []
pre = -1
n = 0
depth = 0
with open(depth_file, 'r') as inf:
for line in inf:
n += 1
line = line.strip().split('\t')[1:]
line[0] = int(line[0])
line[1] = int(line[1])
if n % window == 0 or line[0] == total_job:
pos = (line[0] - 1) / window + 1
depth = depth*1.0 / n
if depth >= 100:
depth = 100
c = 'y^'
a = 0.4
elif depth <= 10 and depth >0:
c = 'b.'
a = 0.8
elif depth == 0:
c = 'rv'
a = 0.8
else:
c = 'k.'
a = 0.4
plt.plot(pos, depth, c, alpha=a, clip_on=False)#, ms=2)
n = 0
depth = 0
else:
depth += line[1]
process = round(line[0] * 100.0 / total_job, 1)
if process > pre:
print '\rProcessing: %s' % str(process) + "%...",
sys.stdout.flush()
pre = process
plt.xlim(0, 119556435/window+1)
plt.ylim(0, 100)
plt.xticks(map(lambda x: (x+1)*tick/window, range(total_job/tick)),
map(lambda x: str((x+1)*10) + 'Mb', range(total_job/tick)),
fontsize=28)
plt.yticks([0, 50, 100], ["0", "50", "100"], fontsize=28)
plt.xlabel('Position', fontsize=34)
plt.ylabel('Depth', fontsize=34)
#plt.gca().set_aspect('equal', adjustable='box')
plt.title(depth_file, loc='left')
plt.grid(b='on', lw=0.4, ls='--', axis='x')
plt.tight_layout()
plt.savefig('%s.w100k.png' % depth_file, dpi=600, transparent=True)
print 'Done.'

Matplotlib version

Operating System: Ubuntu 14.04

Matplotlib Version: 2.0.2

Python Version: 2.7.13

Jupyter Version (if applicable):

Other Libraries: