Reputation: 637
Suppose I have the following script that produces a plot (as shown below) where some datapoints have hatching. At DPI = 200, the hatching frequency (space between dots) is good, but if I want to increase the resolution of the plot (DPI = 600 for example), the dots become very fine. Is there a way to set the gap between dots? Thanks in advance.
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.basemap import Basemap
Sig = np.random.rand(50,50)
Sig = np.ma.masked_greater(Sig, 0.25)
f, ax1 = plt.subplots(1,1)
ax1.pcolor(np.linspace(0,90,50),np.linspace(0,50,50),Sig, hatch=".",alpha=0)
fig = plt.gcf()
fig.set_size_inches(8, 8)
fig.savefig('Trial.png',bbox_inches='tight', dpi=200)
Upvotes: 3
Views: 2462
Reputation: 339430
There is no way to accurately control the spacing between hatch patterns. You do have the option to increase the hatch density though. Instead of hatch = "."
you can add the symbol more often, hatch="..."
; this will produce a denser pattern.
The above figure has been produced with standard dpi of 100. Changing the dpi to 300 gives the following image:
As can be seen the issue of a changed hatch density for different dpi is not there anymore; it has been brought up in this issue and afterwards been fixed. The solution is thus to update to the newest matplotlib version.
Upvotes: 8