I have some data defined on a regular Cartesian grids. I'd like to show only some of them with a condition based on the radius from the center. This will effectively create a ring-like structure with a hole in the center. As a result, I cannot use imshow
. tricontourf
or tripcolor
are what I found to deal with it. My code looks something like this:
R = np.sqrt(x**2+y**2)
flag = (R<150)*(R>10)
plt.tricontourf(x[flag], y[flag], data[flag], 100)
where x
and y
are mesh grids where data
defines. The problem here is that both tricontourf
and tripcolor
try to fill the middle of the ring, where I hope can be left blank.
To be more specific, the one in the left is similar to what I want but I can only get the one in the right with this piece of code shown above.