☰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

Bokeh Annotation Overlapping Issue

Community Support
Abhay_53
Abhay_53

Hi, I am pretty much new to bokeh. I am trying to plot a bubble chart and adding the column labels as an annotation there using Labelset. Some of These Labels are getting overlapped to each other and creating visual clutter in the graph. i have already tried x_offset, y_offset and label rotation to solve this issue, but none of them is working. Please guide me.
similar to what i am trying to accomplish - python - How to create a dynamic labelset on Bokeh that will avoid text overlapping? - Stack Overflow

⌁   Link to post
Abhay_53
Abhay_53

Sure @Bryan , here is the example to reproduce the result

import numpy as np
import pandas as pd
from bokeh.io import output_notebook, output_file
output_notebook()
from bokeh.io import show
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, LabelSet
from bokeh.palettes import Spectral10

df_dict = {
    'Plans': ['ABC ValueCharge', 'Bizbazar 200CarbonNatural', 'EqualiserClient SuperSaverCombo'],
    'Rating': [17, 15, 14],
    'Sales': [1330.443, 1312.271, 1312.168],
    'Spends': [72.49, 47.7, 13.2417514]
}
df = pd.DataFrame.from_dict(df_dict)
p = figure(height = 600, width = 800, x_range = (0, 25), y_range = (800, 2000))
source = ColumnDataSource(data = df)

p.circle(x = 'Rating', y = 'Sales', size = 'Spends',source = source,alpha = 0.8
        )
p.xaxis.axis_label = "Rating"
p.yaxis.axis_label = "Sales"
labels = LabelSet(x='Rating', y='Sales', text='Plans', source = source,
                  x_offset= -50, y_offset=10, text_font_size = '7pt')
p.add_layout(labels)

show(p)

Here, is how the result looks like


Now the text annotation labels are getting overlapped to each other, which i wanted to avoid.

⌁   Link to post

End of archived discussion · Replies are disabled