Doesn't display Altair text when text is positioned with `altair.value()`

Open
#4,780 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start by reproducing the issue with the provided Python snippet and the streamlit.altair_chart entry point, using the listed Streamlit, Python, and browser versions as context. Trace how this chart is rendered in the browser when x and y use altair.value(); done means the “FFS” text appears in the Streamlit browser view as it does in Jupyter.

Written by the indexing model from the issue text.

Description

feature:st.altair_chart priority:P3 status:confirmed type:bug
Summary

Streamlit shows Altair charts with text (made with mark_text()) but it doesn't show it sometimes. Specifically, I've found that it doesn't show text when the text is encode()ed with x and y positions that are altair.value() values. See below.

Steps to reproduce

Open in Streamlit Cloud

Code snippet:

import streamlit
import altair

chart = altair.Chart().mark_text(text="FFS", size=160).encode(x=altair.value(0), y=altair.value(0))
figure = streamlit.altair_chart(chart)

Expected behavior:

A browser window should open with the text "FFS" in a large font, in black. This is expected when you view the chart above in a Jupyter notebook for example.

Actual behavior:

The Altair chart itself shows as expected in Jupyter notebook (for example), but the figure, which I expect to see in a browser when I streamlit run the Python script, doesn't show. Nothing much shows in the browser.

Is this a regression?

I'm new to Streamlit and I have no past reference for comparison.

Debug info
  • Streamlit version: 1.9.0
  • Python version: 3.10.1
  • Using Conda? PipEnv? PyEnv? Pex? None. Just plain pip.
  • OS version: Windows 11
  • Browser version: 101.0.4951.67
Dominant language
Python
Stars
45.8k
Forks
4.4k
Avg merge
21h 22m
Merged PRs (30d)
316

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from streamlit/streamlit

All issues in streamlit/streamlit

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.