Hello everyone.
I was trying to create a heatmap from a dataframe which contains around 10 columns and 300 rows.
I followed this example and I will be using it to further explain my question.
My goal is to limit the user to only see a restricted amount of rows but, at the same time, still be able to navigate through the whole data (with the pan tool for example).
In the provided example it would be refected as being able to only see from January to April (4 rows), February to May, March to June, etcā¦
The closest I got was to limit the the y_range factors to 4 rows:
But that doesnāt allow me to see the other factors on panning.
Is there any way to do what I desire? And if so, could you let me know how?
Additional Questions:
In the same example I see a ColorBar with a specified custom palette. Iām interested in having one but as a gradient (without the ticks, as it happens when we use āViridis256ā as palette) with custom colors as well. Is that something we can do? And if so, how?
I donāt think thereās a nice way of doing that right now since start and end properties of FactorRange are not writable. It should be possible to work around that but Iām pretty sure it would require quite a bit of JavaScript.
Thereās this issue [FEATURE] Add functionality to allow FactorRange.start/end to be writable. Ā· Issue #9254 Ā· bokeh/bokeh Ā· GitHub which sounds similar and has the same root cause. Although the actual problem there is different.
Please feel free to create a feature request on GitHub that better reflects your need.
I donāt think thereās any way to create a true gradient without creating custom color mapper models but at the very least you can remove all the ticks by just specifying ticker=BasicTicker(desired_num_ticks=0).
Thank you for the quick reply. I already opened the feature request in bokeh github.
As a workaround, do you think it would be possible to provide the full data in the histogram and programmatically perform an (initial) zoom (Iām asking this because if I manually zoom the histogram I can achieve what I desire)? Unfortunately, I couldnāt find a way to zoom using the bokeh python API, are you aware of any method to achieve that?
Thanks
The bit that I fail to understand is how the JavaScript gets involved in here.
Iām generating the heatmap on the server-side using the python bokeh module, saving it as a HTML file, and providing it to the client by embedding the page in an āiframeā.
Ideally, the HTML file would be generated already with the initial zoom applied to it (using python). Is this possible?
If not, could you point me to the javascript command that would affect the zoom of the plot?
Thanks
with the initial zoom applied to it (using python).
The start and end properties of FactorRange are read-only on Python side. How are you going to change them?
And you cannot āuseā a tool via Python.
could you point me to the javascript command that would affect the zoom of the plot?
Itās not a single command. As I said, it would require quite a bit of JavaScript. And I donāt know it offhand, otherwise I wouldāve posted it right then and there. It would require me hours to come up with it.