-
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
[Doc] Add Arrow Vector Example #3236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding this example! It's something I would have needed in the past, great to finally know how I can achieve a decent arrow :)
I left some minor comments. Could you also replace all single quotes '
with double quotes "
in the code?
Co-authored-by: Stefan Binder <[email protected]>
Co-authored-by: Stefan Binder <[email protected]>
This example is great! What do you think about also including a separate example showing how to use unicode arrows (or maybe one of each type of arrow in the same chart/example, that's probably better)? I find this quite useful for simpler things where the length of the arrow does not need to be configured, for example: inertias = 35, 11, 4, 3, 3, 2, 1, 1, 2
alt.layer(
alt.Chart(
pd.DataFrame({
'wssd': inertias,
'k': range(1, len(inertias) + 1)
})
).mark_line(point=True).encode(
x=alt.X("k").title("Number of clusters"),
y=alt.Y("wssd").title("Total within-cluster sum of squares"),
),
alt.Chart().mark_text(size=22, align='left', baseline='bottom').encode(
x=alt.datum(3.4),
y=alt.datum(9.8),
text=alt.datum('Elbow')
),
alt.Chart().mark_text(size=50, align='left', baseline='bottom', fontWeight=100, angle=25).encode(
x=alt.datum(2.8),
y=alt.datum(5),
text=alt.datum('🠃')
)
) |
@joelostblom Using unicode arrow is also great!
|
That second chart is a cool example! Although I wonder how common it is to create arrows like that. For this gallery example, I think it would be helpful if we show the most common use case of an arrow, which I think is for annotations. So if we could make a wedge arrow that looks similar to the current unicode arrow but points at some different location on the line in the same chart, I think that would be helpful. For you second example here with the many arrows, maybe it would be useful in a chart like this to show the order the points are connected in even more clearly? We could add a second separate example for that if you think that's a good fit, and maybe include a note about the tricky adjustment of the angles that you mentioned. |
Hi @joelostblom, yes I think showing different method would be better! |
Super, thanks for all your work on this @ChiaLingWeng ! I really like the new example and I just simplified the code slightly in my latest commit. Will merge when tests are passing. |
This will close #914
@binste I find triangle mark may be more suitable and put this example under case studies section,
feel free to let me know if there's anything can be improved!