Skip to content Skip to sidebar Skip to footer

Python Matplotlib - Misaligned Grid Lines And Color Fills

I'm using the following code to produce a sort of binary heatmap: import numpy as np import matplotlib.colors as mlc import matplotlib.pyplot as mlp states = ['AAAA', 'BBBB', 'CCC

Solution 1:

As the comments indicated the problem seems to go away at higher DPI, for future users this is shown below,

50 DPI - Figsize 8, 6

100 DPI - Figsize 8. 6

However it is also influenced by the figsize parameter, set either with matplotlibrcParams or with figsize(height, width) in construction of the figure - larger figures require higher DPI for the display problem to disappear (though it may be necessary to view the full size images to see the effect, instead of the inline display), i.e.

50 DPI - Figsize 20,16

100 DPI - Figsize 20,16

300 DPI - Figsize 20,16

Post a Comment for "Python Matplotlib - Misaligned Grid Lines And Color Fills"