[Matplotlib-users] Plotting boundaries of segmented data

Thomas Caswell tcaswell at gmail.com
Sat Jan 28 11:45:11 EST 2017


Please subscribe to the mailing list so you can post un-moderated (
https://mail.python.org/mailman/listinfo/matplotlib-users )

I think you are looking for the contour family of methods, see
http://matplotlib.org/examples/pylab_examples/contour_demo.html

Tom

On Sat, Jan 28, 2017 at 10:58 AM rwleo <peter.leitner at uni-graz.at> wrote:

> Hello,
>
> I am trying to plot a 2-D array with segmentation data from a fluid flow.
> The data structure is continuous which means that the segments are
> connected
> regions, like in the picture below:
> <http://matplotlib.1069221.n5.nabble.com/file/n47655/figure.png>
> I use
> plt.imshow(seg, cmap="Greys")
> which returns a black area on a white background. What I would like to
> achieve instead is to plot only the boundary as a black curve, like when
> plotting a shape with pylab setting edgecolor=black and facecolor=white.
> Unfortunately, having the data in matrix format I am not sure whether this
> can easily be achieved without writing a separate function that detects
> whether a pixel belongs to the border or the interior. Is there an
> alternative to the imshow function which does this simply by setting some
> keywords?
>
> Secondly I would like to smoothen the boundary curve which looks quite
> "rectangular" due to the coarse segmentation algorithm that has been
> applied
> to the fluid flow data. Can this be done with interp2d, if the segments are
> not based on an analytical expression?
>
> Many thanks in advance!
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Plotting-boundaries-of-segmented-data-tp47655.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170128/abc88f00/attachment.html>


More information about the Matplotlib-users mailing list