One of the new features in the upcoming Bokeh 0.11 is the ability for users to create and use their own custom Bokeh models. The intentions is to open up Bokeh as more of a platform for users to be able to quickly extend Bokeh themselves in any way they need to. The release is January 6th, but you can obtain a "dev build" using the instructions here:
Additionally, a recently contributed example is actually fairly similar to exactly what you are describing (i.e., creating a customized tick formatter). Since the 0.11 is not yet released, the documentation is still being worked on, so an example is probable the best reference for now:
On Dec 24, 2015, at 9:17 AM, Laurent Hausermann <[email protected]> wrote:
Hi all
I am trying to build with Bokeh a graph I'm using actually with Maplotlib. It's a scatterplot (or a kind of bubble graph) with IP addresses as X,Y.
In Bokeh, I am trying to get the same result.
I've done this
p = figure(tools=TOOLS, plot_width=700, plot_height=500)
# add a circle for the IP dataset. Size varies with nb of connection
p.circle(conn['x'], conn['y'], size=conn['count']*20, color="navy", alpha=0.7)
# format labels and ticks to enhance readibility
p.xaxis.axis_label = "Source IP"
p.xaxis[0].formatter = CategoricalTickFormatter()
p.yaxis.axis_label = "Destination IP"
p.yaxis[0].formatter = CategoricalTickFormatter()
My issue is I cannot get the good ticks. I'd like to be able to :
- say that the ticks are in another series than the value (ie IP addresses strings)
- give a call back to transform the value into the tick
The dataset is :
count dstip srcip x y
0 3 192.168.1.2 192.168.1.1 3232236777 3232236778
1 1 192.168.1.3 192.168.1.1 3232236777 3232236779
2 1 192.168.1.99 192.168.1.1 3232236777 3232236875
3 2 192.168.1.22 192.168.1.99 3232236875 3232236798