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

text position and repel on map #1731

Closed
sbonaretti opened this issue Oct 15, 2019 · 19 comments
Closed

text position and repel on map #1731

sbonaretti opened this issue Oct 15, 2019 · 19 comments

Comments

@sbonaretti
Copy link

sbonaretti commented Oct 15, 2019

Hi,

Thanks for developing Altair! Finally a great tool for visualization using the grammar of graphics in python! I am really having a lot of fun with it!

I am visualizing a map using mark_geoshape. I am adding points to the map using mark_point, and corresponding labeling text using mark_text. I have two issues:

  1. The text is not always close to the corresponding point. I use x = "longitude:Q", y = "latitude:Q" both in mark_point and mark_text. As an example, see the distance between the green dot and the green text in the figure attached;
  2. Texts often overlap - see the pink and brown texts in the figure attached. Is there any function similar to ggrepel in ggplot?

Thank you very much again for such a great tool!
Serena

example

@jakevdp
Copy link
Collaborator

jakevdp commented Oct 15, 2019

No, I'm not aware of any functionality to automatically prevent text overlap. It would be worth a feature request in Vega-Lite.

@davidanthoff
Copy link

@domoritz I think in theory this would be addressed by https://github.com/vega/vega-label, right? Are there plans to just integrate that work into the core vega story?

@domoritz
Copy link
Member

Yes and yes. We are working on getting it into Vega and then Vega-Lite. I can't promise a release date yet, though.

@sbonaretti
Copy link
Author

Looking forward!!!

@domoritz
Copy link
Member

@chanwutk

@chanwutk
Copy link

Yes, we are working on getting Vega-Label shipped in Vega. The plan is, then, to add the feature to Vega-Lite. :)

@guilhermeprokisch
Copy link

guilhermeprokisch commented Apr 22, 2020

This feature was implemented? I have a similar problem on my plots.
image

@jakevdp
Copy link
Collaborator

jakevdp commented Apr 22, 2020

No, it has not been implemented yet as far as I am aware.

@domoritz
Copy link
Member

domoritz commented Apr 22, 2020

It has been implemented and we are in the process of releasing the feature in Vega. The code is already in master at https://github.com/vega/vega/tree/master/packages/vega-label. Once we have support in Vega, we can support it in Vega-Lite as well. I can't promise a release date yet but it's coming. Thanks for your patience. It's a big feature to add with a lot of moving parts.

@guilhermeprokisch
Copy link

Ok! Thank you for the reply
:)

@sbonaretti
Copy link
Author

That's a great piece of news! Thanks and looking forward!

@danhamill
Copy link

@jakevdp It looks like vega implemented a label transform in version 5.16. Is there a way to pass transform data that hasn't officially been implemented in altair yet?

https://vega.github.io/vega/docs/transforms/label/

Thanks!

@domoritz
Copy link
Member

domoritz commented Feb 1, 2021

@chanwutk is working on bringing labeling to Vega-Lite at which point we can add it to Altair as well.

@arjunkumarp9
Copy link

Hello@jakevdp,
Any update on how to prevent the text overlap.
Thank you very much in advance.

@joelostblom
Copy link
Contributor

@arjunkumarp9 This was recently merged into Vega-Lite and will be in a future version of Altair.

@arjunkumarp9
Copy link

@joelostblom could you please share some example to avoid the overlapping labels. Thank you very much in advance.

@joelostblom
Copy link
Contributor

@arjunkumarp9 There are some VegaLite examples in the PR I linked above. As I mentioned, this feature is not available yet for Altair.

@domoritz
Copy link
Member

Note that we reverted the pull request to make sure the API is the best it can be and to make sure the docs are up to date as well. Please follow vega/vega-lite#7378.

@joelostblom
Copy link
Contributor

Closing this as it is an upstream issue and there is nothing to do on the Altair side of things. When vega/vega-lite#7378 is merged, this will be in a following altair release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants