Is there a way to increase the width of hatch in matplotlib?
For example, the following code by specifying linewidth
only changes the width of the edge. I
There is a solution which is very hacky, but allows you to do what you want without changing matplotlib internal files: you can monkey patch the writeHatches of PdfFile like so:
# make sure you have the correct imports,
# they may differ depending on the matplotlib version
import matplotlib.backends.backend_pdf
from matplotlib.externals import six
from matplotlib.backends.backend_pdf import Name, Op
from matplotlib.transforms import Affine2D
def setCustomHatchWidth(customWidth):
def _writeHatches(self):
COPY CODE FROM matplotlib.__path__[0] + "/backends/backend_pdf.py" HERE
change the line
self.output(0.1, Op.setlinewidth)
to
self.output(customWidth, Op.setlinewidth)
matplotlib.backends.backend_pdf.PdfFile.writeHatches = _writeHatches
You can then do
setCustomWidth(2)
before saving you figure as pdf.