Reputation: 6651
Am using matplotlib's contourf to do some contour plotting. I would like the contour plot to be filled with a particular sub-region of the data I want to display, leaving the rest of the data out of the picture. Is there a way to do this with contourf?
The xlim/ylim keywords do not help. No error returned, but no effect on the contour plot. Same with the "extent" keyword. Giving contourf just a subsection to plot is not an option (not an easy option, I should say) because my data is on an irregular grid.
Upvotes: 2
Views: 1937
Reputation: 6651
If anyone's interested, it turns out it's pretty easy. I do the contour and then I set x and y limits with matplotlib.pyplot.xlim and ylim:
contourf(x,y,z)
xlim((1000,2000))
ylim((4000,7000))
Upvotes: 1