Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layering mark_rule and mark_text results in text duplication #3774

Open
danhamill opened this issue Jan 17, 2025 · 0 comments
Open

Layering mark_rule and mark_text results in text duplication #3774

danhamill opened this issue Jan 17, 2025 · 0 comments
Labels
bug needs-triage Bug report needs maintainer response

Comments

@danhamill
Copy link

danhamill commented Jan 17, 2025

What happened?

Related to this SO post. For this example on the documentation page:

import pandas as pd
import altair as alt

source = pd.DataFrame({
    "Day": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
    "Value": [55, 112, 65, 38, 80, 138, 120, 103, 395, 200, 72, 51, 112, 175, 131]
})
threshold = 300

bars = alt.Chart(source).mark_bar(color="steelblue").encode(
    x="Day:O",
    y="Value:Q",
)

highlight = bars.mark_bar(color="#e45755").encode(
    y2=alt.Y2(datum=threshold)
).transform_filter(
    alt.datum.Value > threshold
)

rule = alt.Chart().mark_rule().encode(
    y=alt.Y(datum=threshold)
)

label = rule.mark_text(
    x="width",
    dx=-2,
    align="right",
    baseline="bottom",
    text="hazardous"
)

(bars + highlight + rule + label)

The text "hazardous" on the plot looks blurry.

enter image description here

What would you like to happen instead?

I would like the mark_text font/weight to appear the same as the axis labels.

Which version of Altair are you using?

5.5.0

@danhamill danhamill added bug needs-triage Bug report needs maintainer response labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs-triage Bug report needs maintainer response
Projects
None yet
Development

No branches or pull requests

1 participant