☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

filled contour plots

Community Support
Asher_Pembroke
Asher_Pembroke

Hello users!

I am trying to make filled contour plots by converting contour paths from pyplot.contourf to bokeh polygons. The trouble is that these path polygons have interior holes, which causes them to be drawn incorrectly. I know bokeh doesn’t yet support matplotlib’s path drawing codes (such as MOVETO), but is there any workaround you might suggest in the meantime?

I’ve looked into cutting short paths from the exterior to interior holes, but this gets complicated…

best,

Asher

⌁   Link to post
Sarah_Bird3
Sarah_Bird3

I’m not sure if this is quite what you were asking, but bokeh does not currently have support for drawing a polygon (Patch) with a hole in it - this is a feature I’m hoping to work on.

···

On Wed, Jul 15, 2015 at 12:36 AM, Asher Pembroke apembroke@gmail.com wrote:

Hello users!

I am trying to make filled contour plots by converting contour paths from pyplot.contourf to bokeh polygons. The trouble is that these path polygons have interior holes, which causes them to be drawn incorrectly. I know bokeh doesn’t yet support matplotlib’s path drawing codes (such as MOVETO), but is there any workaround you might suggest in the meantime?

I’ve looked into cutting short paths from the exterior to interior holes, but this gets complicated…

best,

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJGdP6Cqw9PtcN5UoZ8G6Gj_V-eqv0spCRrTYUhN1MZT%2Bg%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Asher_Pembroke
Asher_Pembroke

Right, I was just looking for a workaround until patches with holes are implemented.

I’m thinking of triangulating the contours and checking if each triangle is in a given path, then using that path’s color.

···

On Wed, Jul 15, 2015 at 12:36 AM, Asher Pembroke apembroke@gmail.com wrote:

Hello users!

I am trying to make filled contour plots by converting contour paths from pyplot.contourf to bokeh polygons. The trouble is that these path polygons have interior holes, which causes them to be drawn incorrectly. I know bokeh doesn’t yet support matplotlib’s path drawing codes (such as MOVETO), but is there any workaround you might suggest in the meantime?

I’ve looked into cutting short paths from the exterior to interior holes, but this gets complicated…

best,

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJGdP6Cqw9PtcN5UoZ8G6Gj_V-eqv0spCRrTYUhN1MZT%2Bg%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Sarah_Bird3
Sarah_Bird3

Sorry, late night mailing reading!

It depends how much interaction you’re trying to do. If you’re not trying to do any, does it make sense to try doing it so the data is ordered so that the contours stack on top of each other?

···

On Wed, Jul 15, 2015 at 1:40 AM, Asher Pembroke apembroke@gmail.com wrote:

Right, I was just looking for a workaround until patches with holes are implemented.

I’m thinking of triangulating the contours and checking if each triangle is in a given path, then using that path’s color.

On Tue, Jul 14, 2015, 7:08 PM Sarah Bird sbird@alum.mit.edu wrote:

I’m not sure if this is quite what you were asking, but bokeh does not currently have support for drawing a polygon (Patch) with a hole in it - this is a feature I’m hoping to work on.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTs95%2B0SjM-R%2Bz9cPBK93cx6gnEpehxP_qE%2Bn9Va3DS1Q%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJEpXje8j3u6%2BYyVNsNvJk8VpPgnnwkm5UoJjDnO7%3D%2B3fw%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 12:36 AM, Asher Pembroke apembroke@gmail.com wrote:

Hello users!

I am trying to make filled contour plots by converting contour paths from pyplot.contourf to bokeh polygons. The trouble is that these path polygons have interior holes, which causes them to be drawn incorrectly. I know bokeh doesn’t yet support matplotlib’s path drawing codes (such as MOVETO), but is there any workaround you might suggest in the meantime?

I’ve looked into cutting short paths from the exterior to interior holes, but this gets complicated…

best,

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJGdP6Cqw9PtcN5UoZ8G6Gj_V-eqv0spCRrTYUhN1MZT%2Bg%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Asher_Pembroke
Asher_Pembroke

Hi Sarah, (and to whomever else this may concern.)

I tried using scipy’s delaunay triangulation and found that it produced some unsavory artifacts and wasn’t as fast as I’d hoped. I hunted around for a few days looking for a solution to plan B: connecting the interior rings to the exterior boundaries of the polys to form a “weakly simple” polygon. I finally found this post which asks this exact question.

http://cs.stackexchange.com/questions/43758/turning-a-simple-polygon-with-holes-into-exterior-bounded-only

The good news is that it can be solved in O(N*logN) time by creating a minimum spanning tree.

https://en.wikipedia.org/wiki/Euclidean_minimum_spanning_tree#Subtree_of_Delaunay_triangulation

The not-so-good news is that there doesn’t appear to be a handy python implementation…

···

On Wed, Jul 15, 2015 at 6:10 AM, Sarah Bird sbird@alum.mit.edu wrote:

Sorry, late night mailing reading!

It depends how much interaction you’re trying to do. If you’re not trying to do any, does it make sense to try doing it so the data is ordered so that the contours stack on top of each other?

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTLjqrTU3giyvB5ponhzkM%2Bnua8ZY1roTN3jhFnVMujdQ%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 1:40 AM, Asher Pembroke apembroke@gmail.com wrote:

Right, I was just looking for a workaround until patches with holes are implemented.

I’m thinking of triangulating the contours and checking if each triangle is in a given path, then using that path’s color.

On Tue, Jul 14, 2015, 7:08 PM Sarah Bird sbird@alum.mit.edu wrote:

I’m not sure if this is quite what you were asking, but bokeh does not currently have support for drawing a polygon (Patch) with a hole in it - this is a feature I’m hoping to work on.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTs95%2B0SjM-R%2Bz9cPBK93cx6gnEpehxP_qE%2Bn9Va3DS1Q%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJEpXje8j3u6%2BYyVNsNvJk8VpPgnnwkm5UoJjDnO7%3D%2B3fw%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 12:36 AM, Asher Pembroke apembroke@gmail.com wrote:

Hello users!

I am trying to make filled contour plots by converting contour paths from pyplot.contourf to bokeh polygons. The trouble is that these path polygons have interior holes, which causes them to be drawn incorrectly. I know bokeh doesn’t yet support matplotlib’s path drawing codes (such as MOVETO), but is there any workaround you might suggest in the meantime?

I’ve looked into cutting short paths from the exterior to interior holes, but this gets complicated…

best,

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJGdP6Cqw9PtcN5UoZ8G6Gj_V-eqv0spCRrTYUhN1MZT%2Bg%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Asher_Pembroke
Asher_Pembroke

Hi Everyone,

I’ve made a function that converts matplotlib’s filled contours with holes into bokeh polygons without holes. We should now be able to do transparencies and hover tools, in addition to highlighting different contour ranges.

https://github.com/asher-pembroke/bokeh-tools

Cheers!

Asher

···

On Mon, Jul 20, 2015 at 6:07 PM, Asher Pembroke apembroke@gmail.com wrote:

Hi Sarah, (and to whomever else this may concern.)

I tried using scipy’s delaunay triangulation and found that it produced some unsavory artifacts and wasn’t as fast as I’d hoped. I hunted around for a few days looking for a solution to plan B: connecting the interior rings to the exterior boundaries of the polys to form a “weakly simple” polygon. I finally found this post which asks this exact question.

http://cs.stackexchange.com/questions/43758/turning-a-simple-polygon-with-holes-into-exterior-bounded-only

The good news is that it can be solved in O(N*logN) time by creating a minimum spanning tree.

https://en.wikipedia.org/wiki/Euclidean_minimum_spanning_tree#Subtree_of_Delaunay_triangulation

The not-so-good news is that there doesn’t appear to be a handy python implementation…

On Wed, Jul 15, 2015 at 6:10 AM, Sarah Bird sbird@alum.mit.edu wrote:

Sorry, late night mailing reading!

It depends how much interaction you’re trying to do. If you’re not trying to do any, does it make sense to try doing it so the data is ordered so that the contours stack on top of each other?

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTLjqrTU3giyvB5ponhzkM%2Bnua8ZY1roTN3jhFnVMujdQ%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 1:40 AM, Asher Pembroke apembroke@gmail.com wrote:

Right, I was just looking for a workaround until patches with holes are implemented.

I’m thinking of triangulating the contours and checking if each triangle is in a given path, then using that path’s color.

On Tue, Jul 14, 2015, 7:08 PM Sarah Bird sbird@alum.mit.edu wrote:

I’m not sure if this is quite what you were asking, but bokeh does not currently have support for drawing a polygon (Patch) with a hole in it - this is a feature I’m hoping to work on.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTs95%2B0SjM-R%2Bz9cPBK93cx6gnEpehxP_qE%2Bn9Va3DS1Q%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJEpXje8j3u6%2BYyVNsNvJk8VpPgnnwkm5UoJjDnO7%3D%2B3fw%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 12:36 AM, Asher Pembroke apembroke@gmail.com wrote:

Hello users!

I am trying to make filled contour plots by converting contour paths from pyplot.contourf to bokeh polygons. The trouble is that these path polygons have interior holes, which causes them to be drawn incorrectly. I know bokeh doesn’t yet support matplotlib’s path drawing codes (such as MOVETO), but is there any workaround you might suggest in the meantime?

I’ve looked into cutting short paths from the exterior to interior holes, but this gets complicated…

best,

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJGdP6Cqw9PtcN5UoZ8G6Gj_V-eqv0spCRrTYUhN1MZT%2Bg%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Peter_Wang1
Peter_Wang1

Thanks for putting this together, Asher! This looks very neat!

-Peter

···

On Mon, Aug 17, 2015 at 5:40 PM, Asher Pembroke apembroke@gmail.com wrote:

Hi Everyone,

I’ve made a function that converts matplotlib’s filled contours with holes into bokeh polygons without holes. We should now be able to do transparencies and hover tools, in addition to highlighting different contour ranges.

https://github.com/asher-pembroke/bokeh-tools

Cheers!

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJHMnz4STu4qKgUBLdOQGEgs7JogaD71Rdnh4JekmjgjCQ%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Mon, Jul 20, 2015 at 6:07 PM, Asher Pembroke apembroke@gmail.com wrote:

Hi Sarah, (and to whomever else this may concern.)

I tried using scipy’s delaunay triangulation and found that it produced some unsavory artifacts and wasn’t as fast as I’d hoped. I hunted around for a few days looking for a solution to plan B: connecting the interior rings to the exterior boundaries of the polys to form a “weakly simple” polygon. I finally found this post which asks this exact question.

http://cs.stackexchange.com/questions/43758/turning-a-simple-polygon-with-holes-into-exterior-bounded-only

The good news is that it can be solved in O(N*logN) time by creating a minimum spanning tree.

https://en.wikipedia.org/wiki/Euclidean_minimum_spanning_tree#Subtree_of_Delaunay_triangulation

The not-so-good news is that there doesn’t appear to be a handy python implementation…

On Wed, Jul 15, 2015 at 6:10 AM, Sarah Bird sbird@alum.mit.edu wrote:

Sorry, late night mailing reading!

It depends how much interaction you’re trying to do. If you’re not trying to do any, does it make sense to try doing it so the data is ordered so that the contours stack on top of each other?

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTLjqrTU3giyvB5ponhzkM%2Bnua8ZY1roTN3jhFnVMujdQ%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 1:40 AM, Asher Pembroke apembroke@gmail.com wrote:

Right, I was just looking for a workaround until patches with holes are implemented.

I’m thinking of triangulating the contours and checking if each triangle is in a given path, then using that path’s color.

On Tue, Jul 14, 2015, 7:08 PM Sarah Bird sbird@alum.mit.edu wrote:

I’m not sure if this is quite what you were asking, but bokeh does not currently have support for drawing a polygon (Patch) with a hole in it - this is a feature I’m hoping to work on.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTs95%2B0SjM-R%2Bz9cPBK93cx6gnEpehxP_qE%2Bn9Va3DS1Q%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJEpXje8j3u6%2BYyVNsNvJk8VpPgnnwkm5UoJjDnO7%3D%2B3fw%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 12:36 AM, Asher Pembroke apembroke@gmail.com wrote:

Hello users!

I am trying to make filled contour plots by converting contour paths from pyplot.contourf to bokeh polygons. The trouble is that these path polygons have interior holes, which causes them to be drawn incorrectly. I know bokeh doesn’t yet support matplotlib’s path drawing codes (such as MOVETO), but is there any workaround you might suggest in the meantime?

I’ve looked into cutting short paths from the exterior to interior holes, but this gets complicated…

best,

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJGdP6Cqw9PtcN5UoZ8G6Gj_V-eqv0spCRrTYUhN1MZT%2Bg%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Asher_Pembroke
Asher_Pembroke

You’re welcome, it was fun! This project reminded me of doing integrals in the complex plane, or how to do it in 3D for analyzing field line spaghetti plots :slight_smile:

···

On Tue, Aug 18, 2015 at 1:01 AM, Peter Wang pwang@continuum.io wrote:

Thanks for putting this together, Asher! This looks very neat!

-Peter

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CABGrp%2B8o7G13C73Mwaeb%2B3qmPXgNDaBTnjfEOLWuKNbbDr2zdA%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Mon, Aug 17, 2015 at 5:40 PM, Asher Pembroke apembroke@gmail.com wrote:

Hi Everyone,

I’ve made a function that converts matplotlib’s filled contours with holes into bokeh polygons without holes. We should now be able to do transparencies and hover tools, in addition to highlighting different contour ranges.

https://github.com/asher-pembroke/bokeh-tools

Cheers!

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJHMnz4STu4qKgUBLdOQGEgs7JogaD71Rdnh4JekmjgjCQ%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Mon, Jul 20, 2015 at 6:07 PM, Asher Pembroke apembroke@gmail.com wrote:

Hi Sarah, (and to whomever else this may concern.)

I tried using scipy’s delaunay triangulation and found that it produced some unsavory artifacts and wasn’t as fast as I’d hoped. I hunted around for a few days looking for a solution to plan B: connecting the interior rings to the exterior boundaries of the polys to form a “weakly simple” polygon. I finally found this post which asks this exact question.

http://cs.stackexchange.com/questions/43758/turning-a-simple-polygon-with-holes-into-exterior-bounded-only

The good news is that it can be solved in O(N*logN) time by creating a minimum spanning tree.

https://en.wikipedia.org/wiki/Euclidean_minimum_spanning_tree#Subtree_of_Delaunay_triangulation

The not-so-good news is that there doesn’t appear to be a handy python implementation…

On Wed, Jul 15, 2015 at 6:10 AM, Sarah Bird sbird@alum.mit.edu wrote:

Sorry, late night mailing reading!

It depends how much interaction you’re trying to do. If you’re not trying to do any, does it make sense to try doing it so the data is ordered so that the contours stack on top of each other?

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTLjqrTU3giyvB5ponhzkM%2Bnua8ZY1roTN3jhFnVMujdQ%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 1:40 AM, Asher Pembroke apembroke@gmail.com wrote:

Right, I was just looking for a workaround until patches with holes are implemented.

I’m thinking of triangulating the contours and checking if each triangle is in a given path, then using that path’s color.

On Tue, Jul 14, 2015, 7:08 PM Sarah Bird sbird@alum.mit.edu wrote:

I’m not sure if this is quite what you were asking, but bokeh does not currently have support for drawing a polygon (Patch) with a hole in it - this is a feature I’m hoping to work on.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTs95%2B0SjM-R%2Bz9cPBK93cx6gnEpehxP_qE%2Bn9Va3DS1Q%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJEpXje8j3u6%2BYyVNsNvJk8VpPgnnwkm5UoJjDnO7%3D%2B3fw%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 12:36 AM, Asher Pembroke apembroke@gmail.com wrote:

Hello users!

I am trying to make filled contour plots by converting contour paths from pyplot.contourf to bokeh polygons. The trouble is that these path polygons have interior holes, which causes them to be drawn incorrectly. I know bokeh doesn’t yet support matplotlib’s path drawing codes (such as MOVETO), but is there any workaround you might suggest in the meantime?

I’ve looked into cutting short paths from the exterior to interior holes, but this gets complicated…

best,

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJGdP6Cqw9PtcN5UoZ8G6Gj_V-eqv0spCRrTYUhN1MZT%2Bg%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Sarah_Bird3
Sarah_Bird3

This is very cool Asher - thanks for sharing.

···

On Tue, Aug 18, 2015 at 6:18 AM, Asher Pembroke apembroke@gmail.com wrote:

You’re welcome, it was fun! This project reminded me of doing integrals in the complex plane, or how to do it in 3D for analyzing field line spaghetti plots :slight_smile:

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJG98w2JHO0vUBhDo%2B7Nz-uAB6vBj3kEjTr61BMc9H1EEA%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Tue, Aug 18, 2015 at 1:01 AM, Peter Wang pwang@continuum.io wrote:

Thanks for putting this together, Asher! This looks very neat!

-Peter

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CABGrp%2B8o7G13C73Mwaeb%2B3qmPXgNDaBTnjfEOLWuKNbbDr2zdA%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Mon, Aug 17, 2015 at 5:40 PM, Asher Pembroke apembroke@gmail.com wrote:

Hi Everyone,

I’ve made a function that converts matplotlib’s filled contours with holes into bokeh polygons without holes. We should now be able to do transparencies and hover tools, in addition to highlighting different contour ranges.

https://github.com/asher-pembroke/bokeh-tools

Cheers!

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJHMnz4STu4qKgUBLdOQGEgs7JogaD71Rdnh4JekmjgjCQ%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Mon, Jul 20, 2015 at 6:07 PM, Asher Pembroke apembroke@gmail.com wrote:

Hi Sarah, (and to whomever else this may concern.)

I tried using scipy’s delaunay triangulation and found that it produced some unsavory artifacts and wasn’t as fast as I’d hoped. I hunted around for a few days looking for a solution to plan B: connecting the interior rings to the exterior boundaries of the polys to form a “weakly simple” polygon. I finally found this post which asks this exact question.

http://cs.stackexchange.com/questions/43758/turning-a-simple-polygon-with-holes-into-exterior-bounded-only

The good news is that it can be solved in O(N*logN) time by creating a minimum spanning tree.

https://en.wikipedia.org/wiki/Euclidean_minimum_spanning_tree#Subtree_of_Delaunay_triangulation

The not-so-good news is that there doesn’t appear to be a handy python implementation…

On Wed, Jul 15, 2015 at 6:10 AM, Sarah Bird sbird@alum.mit.edu wrote:

Sorry, late night mailing reading!

It depends how much interaction you’re trying to do. If you’re not trying to do any, does it make sense to try doing it so the data is ordered so that the contours stack on top of each other?

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTLjqrTU3giyvB5ponhzkM%2Bnua8ZY1roTN3jhFnVMujdQ%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 1:40 AM, Asher Pembroke apembroke@gmail.com wrote:

Right, I was just looking for a workaround until patches with holes are implemented.

I’m thinking of triangulating the contours and checking if each triangle is in a given path, then using that path’s color.

On Tue, Jul 14, 2015, 7:08 PM Sarah Bird sbird@alum.mit.edu wrote:

I’m not sure if this is quite what you were asking, but bokeh does not currently have support for drawing a polygon (Patch) with a hole in it - this is a feature I’m hoping to work on.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BEr%2BdTs95%2B0SjM-R%2Bz9cPBK93cx6gnEpehxP_qE%2Bn9Va3DS1Q%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJEpXje8j3u6%2BYyVNsNvJk8VpPgnnwkm5UoJjDnO7%3D%2B3fw%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wed, Jul 15, 2015 at 12:36 AM, Asher Pembroke apembroke@gmail.com wrote:

Hello users!

I am trying to make filled contour plots by converting contour paths from pyplot.contourf to bokeh polygons. The trouble is that these path polygons have interior holes, which causes them to be drawn incorrectly. I know bokeh doesn’t yet support matplotlib’s path drawing codes (such as MOVETO), but is there any workaround you might suggest in the meantime?

I’ve looked into cutting short paths from the exterior to interior holes, but this gets complicated…

best,

Asher

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOkquJGdP6Cqw9PtcN5UoZ8G6Gj_V-eqv0spCRrTYUhN1MZT%2Bg%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled