How to remove the borders on the colorbar(or make them thinner)?
I tried pretty much every combination of the following:
cb = plt.colorbar(im3,drawedges=False) #or True with next two lines
#cb.outline.set_linewidth(0)
#cb.dividers.set_linewidth(0)
cb.solids.set_rasterized(True)
cb.solids.set_edgecolor("face")
#Im saving as pdf
plt.savefig("thing.pdf",dpi=1000, bbox_inches='tight')
Some of these help when viewed with the matplotlib figure, but the saved pdf is even worse.
Setting cb.outline.set_visible()
to False
removes the outline, both in the figure and in the saved pdf. I observed that setting the line's width to something small also was reflected in the output file.
import matplotlib.pyplot as plt
import numpy as np
data = np.random.rand(2,2)
im3 = plt.imshow(data)
cb = plt.colorbar(im3)
cb.outline.set_visible(False)
# this worked on matplotlib 1.3.1
#cb.outline.set_linewidth(0.05)
cb.set_ticks([])
#Im saving as pdf
plt.savefig("thing.pdf",dpi=1000, bbox_inches='tight')