☰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

Nice scatterplot of IP address

Community Support
Laurent_Hausermann
Laurent_Hausermann

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

Thanks for your help. And Merry Christmas !
⌁   Link to post
Bryan
Bryan

Hi Laurent,

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:

  <no title> — Bokeh 3.3.2 Documentation

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:

  https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/custom_datetime_axis.py

Let me know if we can answer any other questions,

Bryan

···

On Dec 24, 2015, at 9:17 AM, Laurent Hausermann <laurent.hausermann@gmail.com> 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

Thanks for your help. And Merry Christmas !

--
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/8b1c5f98-d0ae-457a-8629-55c9ac6c50a0%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled