Basically, what I'm trying to do is the idea explained in the answer for this question.
I plot an image 100 x 100 with imshow
and, at certain points, I would like to plot hatches.
So, here is my image example:
This represents the mean of 100 samples of scalar fields. I also have the standard deviation for this samples:
So, what I would like to do is to plot the mean property combined to hatches at the positions in which I have standard deviation > 0.0.
My data are 100 x 100 and its dimension varies form -4 to 4. Following the idea presented here, my current approach was that:
plt.figure()
fig = plt.imshow(scalar_field, origin='lower', extent=(-4, 4, -4, 4))
plt.colorbar(fig)
x_indices = numpy.nonzero(standard_deviation)[0]
y_indices = numpy.nonzero(standard_deviation)[1]
ax = plt.gca()
for p in range(len(x_indices)):
i = x_indices[p]
j = y_indices[p]
ax.add_patch(patches.Rectangle((i-.5, j-.5), 1, 1, hatch='//', fill=False, snap=False))
plt.show()
plt.close()
However, I don't get the patterns at the correct locations. I haven't used patches so far and I don't know if I'm using them in properly way.
Any help would be appreciated.