I'm tracking a subject's gaze over a specified area of a computer screen. I'm constructing gaze heatmaps using pyplot's hist2d
function.
Here's a simple example:
figure()
hist2d(xval, yval, bins=1000)
xlim([-6, 6])
ylim([-4.5, 4.5])
As you can see, there is a significant area outside of the range of my data. However, I would like to set this area to the blue indicative of a zero-value.
My first attempt using imshow
can be seen here:
figure()
imshow(np.array([[0] * 8] * 12), extent=[-6, 6, -4.5, 4.5])
hist2d(xval, yval, bins=1000)
xlim([-6, 6])
ylim([-4.5, 4.5])
This sort of works, but leaves an ugly vertical line at the boundary of my data's range.
My questions are as follows:
- Is there a way to fill the figure with the zero-value blue while avoiding the
imshow
call - If not, how can I hide the vertical line?