Multiline text in mark_text? #2674
Answered
by
joelostblom
arogozhnikov
asked this question in
Q&A
-
There is a related issue for axes labels and titles that suggests passing lists of string for multilines, but it does not work for just pandas columns with multiline strings that are passed to mark_text. If more context is needed, I want to display multiline text over the heatmap, like in this example. |
Beta Was this translation helpful? Give feedback.
Answered by
joelostblom
Aug 29, 2022
Replies: 1 comment 1 reply
-
import pandas as pd
import altair as alt
alt.Chart(pd.DataFrame({'a': [['one', 'two']]})).mark_text().encode(
x=alt.value(0),
y=alt.value(0),
text='a'
) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
arogozhnikov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mark_text
works the same as axes labels and titles. Pandas columns that contain lists will be split onto multiple lines (works for both string and numbers):