-
Notifications
You must be signed in to change notification settings - Fork 794
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
Example gallery should show how to mark and label the final value in a timeseries #2622
Labels
Comments
Agree! I think direct labeling is often preferred over legends and I recently came across this example (bottom of the page) in the VegaLite docs that uses |
Good idea. How's this look? import altair as alt
from vega_datasets import data
source = data.stocks()
chart = alt.Chart(source).transform_filter(
alt.datum.symbol != "IBM" # A reducation of the dataset to clarify our example. Not required.
).encode(
color=alt.Color("symbol", legend=None)
)
line = chart.mark_line().encode(
x="date:T",
y="price:Q"
)
label = chart.encode(
x=alt.X('date:T', aggregate='max'),
y=alt.Y('price:Q', aggregate={'argmax': 'date'}),
text='symbol'
)
text = label.mark_text(align='left', dx=4)
circle = label.mark_circle()
line + circle + text |
palewire
added a commit
to palewire/altair
that referenced
this issue
Jun 29, 2022
The PR is submitted in #2623 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Charts like this have become commonplace in the COVID pandemic. It would be great to include an example showing how to do it. I'd submit a pull request, but I don't know how to do it! If someone can show me how, I'll submit an example for the docs.
The text was updated successfully, but these errors were encountered: