Contouring #12021
Replies: 8 comments 16 replies
-
I will spend some time looking at the |
Beta Was this translation helpful? Give feedback.
-
copy from #12020
|
Beta Was this translation helpful? Give feedback.
-
@ianthomas23 I believe each line in a Edit: yes, see: https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html#missing-points Alternatively, extending the above discussion, a |
Beta Was this translation helpful? Give feedback.
-
I should add, I am not opposed to adding a |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hi there, first off I really appreciate the effort. I have a few questions/thoughts about this. I've dabbled in implementing JS-side contouring in a few scenarios (see my "bokriging" example below)... but a full on framework would be just amazing.
This kinda which leads me to my next question:
My example harnessing krige.js (https://oeo4b.github.io/) to make a little sandbox visualization of the kriging parameters: Either way I really appreciate there's chatter about this kind of feature :-D Thanks! |
Beta Was this translation helpful? Give feedback.
-
Awesome thanks for the clarification/down low. @ianthomas23 There are approximately a gajillion applications for this in my field (hydrogeology) alone. The whole field is basically an interpolation/extrapolation haha:
All of these interpolations/contours go into big numerical models, a lot of which require a crap tonne of expert software training/experience to really utilize/understand, not to mention insane licensing costs. Bokeh comes in for me to pull only the relevant stuff out of those models and to convey that info to the client in a way that's engaging and meaningful for them. A basic example of this would be to run a model where they pump a well really hard for a period of time. The system around it depressurizes/dewaters and the model calculates a simulated water level decline (i.e. "Drawdown" or DD) at thousands of model nodes for several time steps. It's a finite element model usually for me meaning these nodes are irregularly spaced. Anyway, I dump the X-Y--DD--Time data from the model, then generate DD contours for each time step with this kind function, using mpl's tricontour, some finagling of accessing the contour geoms, and using geopandas/shapely to return a geodataframe of line geoms:
Then I transform that geodataframe into a bokeh CDS or a dictionary containing the xs/ys components of the line geoms. Then a CustomJS callback on a slider lets the user "move through time" and see the drawdown propagate in space etc. It's super efficient data wise because basically I'm only pulling the relevant contour geoms and not the actual data itself into the html, and that's all I need to convey what's happening to the client/decision maker etc. That kinda leads me to my next point... this ContourRenderer model would obviously streamline the above described kind of workflow (like... big time :-D ), but will it dump the "raw" data to the html as well as the contour line/patch geom? That'll come at signficant size expense (like thousands of nodes for thousands for potentially hundreds of time steps in my above example)... But... if I ever want to be able to contour JS side.... obviously I need access to the raw data (and that's what I was kinda alluding to before and demonstrating with my gif --> I'd like the ability to change the raw data on JS side and get the contours re-rendered there via my own custom stuff... So is the idea to have two separate CDS's, one containing the raw data, and one containing the contour geoms, both held within the ContourRenderer model? This was the approach to GraphRenderer correct? My very, (very), humble suggestion would be to NOT write the raw data CDS component to the html (or at the very least give the user to option not to), in the interest of not writing redundant data that is not being rendered nor being used js-side, unless of course the user WANTS it to.... this would just require them passing it as an arg in a CustomJS model, or using it to drive a different renderer (e.g. the circles in my gif). Then kinda like @bryevdv mentioned, if I can access and manipulate the contour geom CDS via CustomJS as well.. then I'm free to implement my own crazy js-side interpolation routines if I want. But it also gives me the option of passing only the contour CDS into the html as well if i don't need the "raw" data. Hope that kinda makes sense, happy to try and elaborate if it doesn't at all... Regarding tweeting that gif @bryevdv a lot of the colors got all messed up when i made the gif --> the circle points aren't actually supposed to change in color! So let me try and make a higher quality one and i'll pass that to you for twitterland :-) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
This is a place for us to discuss how to proceed with contouring in bokeh. There is a demo PR at #12020. There is lots to discuss eventually, such as
MultiPolygons
andMultiLine
glyphs, or do we need a bespokeContourRenderer
that is a bit like theGraphRenderer
.My first real question is about the use of
MultiLine
for contour lines. Using aMultiPolygons
object for filled contours works really well, the demo contours multiple levels and put them all together in oneMultiPolygons
object with a vectorfill_color
. But there isn't an equivalent for contour lines because we don't have aMultiLines
(note thes
at the end) object. So (1) I can create a singleMultiLine
glyph for each contour line level, with a scalarline_color
, but then I am dealing with multiple of these for the complete set of contour lines compared to the singleMultiPolygons
object for the complete set of filled polygons. Alternatively (2) I could use a singleMultiLine
glyph for the complete set, but this becomes a little trickier to manage as the vectorline_color
is the same length as the total number of lines across all contour levels not just one per contour level. Or (3) create a newMultiLines
glyph analogous toMultiPolygons
.Beta Was this translation helpful? Give feedback.
All reactions