简体   繁体   中英

Show only a specified sub-region in a matplotlib contour plot

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.

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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM