☰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

Draw MultiDim data in bokeh

Community Support
MisterKo
MisterKo

Hi all, I’m having a problem, I can’t display the multidimensional data and I keep getting problems:

ValueError: failed to validate Text(id='1037', ...).x: expected an element of either String, Dict(Enum

My data looks like this:

all_data = {
    'price': [10, 12, 13],
    'str': ['A', 'B', 'C'],
    'day': "1"
}

i try to:

p.text(ColumnDataSource(all_data))

but it doesnt work
What I wanna to see is this:


Someone help! Thx so much!

⌁   Link to post
Bryan
Bryan

@MisterKo please refer to the User’s Guide docs written to explain just how this works, and then reply back if you are still encountering issues:

Specifically, compare to what you have above to the section Plotting With a ColumnDataSource.

⌁   Link to post
MisterKo
MisterKo

Here it is:

from bokeh.plotting import figure, show
from bokeh.io import curdoc, output_file
from bokeh.models import NumeralTickFormatter, ColumnDataSource

# plot
curdoc().theme = "dark_minimal"
output_file("index.html")

# create new plot
p = figure(
    title="Example",
    sizing_mode="stretch_both",
)

all_data = {
    'price': [10, 12, 13],
    'str': ['A', 'B', 'C'],
    'day': "1"
}

p.text(ColumnDataSource(all_data))
p.yaxis[0].formatter = NumeralTickFormatter(format="$0.00")

show(p)
⌁   Link to post
Bryan
Bryan

Simplified a bit, with some annotations

from bokeh.plotting import figure, show, ColumnDataSource

# need to provide factors for a categorical range (i.e. "string" coords)
p = figure(x_range=["1"])

all_data = {
    # all columns must have SAME length -- just like DataFrame
    'day'   : ["1", "1", "1"],
    'price' : [10, 12, 13],
    'str'   : ["A", "B", "C"],
}

source = ColumnDataSource(data=all_data)

# specify column names from the data source -- explicit, not magic
p.text(x="day", y="price", text="str", source=source)

show(p)

⌁   Link to post

End of archived discussion · Replies are disabled