Skip to content

[Bug]: Issue with plotnine + Ibis #2026

@deepyaman

Description

@deepyaman

Component

Input/Output Bindings

Severity

P3 - Low (minor inconvenience)

Shiny Version

1.4.0

Python Version

3.13.4

Minimal Reproducible Example

import narwhals as nw
import ibis
from plotnine import aes, geom_histogram, ggplot, theme_minimal
from shiny.express import input, render, ui

# Initialize the Ibis connection
con = ibis.duckdb.connect(database=':memory:')
con.create_table("penguins", ibis.examples.penguins.fetch())

ui.input_radio_buttons(
    id="species",
    label="Species",
    choices=["Adelie", "Chinstrap", "Gentoo"],
    inline=True,
)

# dat = load_penguins()
# dat = ibis.examples.penguins.fetch()
dat = con.table("penguins")
# dat = nw.from_native(con.table("penguins"))  # NARWHALS
# dat.head()

species = "Gentoo"  # Adelie, Gentoo, Chinstrap
# sel = dat.filter(nw.col("species") == species)  # NARWHALS


@render.plot
def plot():
    sel = dat.filter(dat.species == input.species())
    return (
        ggplot(aes(x="bill_length_mm"))
        + geom_histogram(dat, fill="#C2C2C4", binwidth=1)
        + geom_histogram(sel, fill="#447099", binwidth=1)
        + theme_minimal()
    )

Behavior

I get an error. The below is after manually applying a patch from #1773 to my Shiny source (to be able to actually render something).

Error Messages (if any)

(scipy-2025-shiny) deepyaman@Deepyamans-MacBook-Pro scipy-2025-shiny % shiny run app-penguin.py
Express has suppressed the object `DatabaseTable: memory.main.penguins
  species           string
  island         ...` because it is of type <class 'ibis.expr.types.relations.Table'>. Coerce to HTML, a string, or an htmltools tag to display this object.

Environment

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions