Search code examples
pythonnumpymatplotlibbokeh

contour plot in bokeh


I would like to use pyplot.contour feature in bokeh. Is there any way I can use it?? Matplotlib Contour Example I know pyplot.pcolormesh and bokeh.plotting.image. Can I use conotur plot with it?


Solution

  • pyplot.contour is part of Matplotlib, not Bokeh. As of Bokeh 2.3.0 there is no built-in contouring function or capability. Recently a MultiPolygons glyph that can support "polygons with holes" was added. This is a first necessary step to being able to have real contour plots in Bokeh. A next step would be for someone to write a set of functions that can accept array inputs and generate the multi-polygon data necessary to drive Bokeh graphics, but this has not been done by anyone yet.

    If image contour plots (similar to pcolormesh) or line (unfilled) contours suit your needs, that you can consider using Holoviews, which can generate Bokeh contour plots for those kinds of cases:

    http://holoviews.org/reference/elements/bokeh/Contours.html