I have a 2d numpy array that consists of blocks of contiguous values. Here's an example. I would like to plot lines around the values. Is there a simple way to do this?
Asked
Active
Viewed 247 times
1
-
Do you mean lines around _every_ point? You can do that with `plt.pcolor(two_dim_array, shading='faceted')`. If you want lines only between regions of same values (your example suggests that a bit), I think this might be a bit more complicated. – Michael H. Apr 17 '17 at 20:36
-
I am indeed trying to put a border around regions of the same value. I was afraid it would be more complicated than it seems. – Chris Apr 17 '17 at 20:57
-
2You may use a contour plot to draw the edges. If necessary, you may then increase the resolution of the contour as seen in this question: [Can matplotlib contours match pixel edges?](http://stackoverflow.com/questions/40892203/can-matplotlib-contours-match-pixel-edges). – ImportanceOfBeingErnest Apr 18 '17 at 06:40