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

Relative placement of annotations #904

Closed
oracle5th opened this issue Dec 20, 2024 · 2 comments
Closed

Relative placement of annotations #904

oracle5th opened this issue Dec 20, 2024 · 2 comments
Labels

Comments

@oracle5th
Copy link

Is it possible to place annotations at relative position of the plotting panel like legend_position_inside?

Similar to this ggplot issue:
tidyverse/ggplot2#1244

However, the solution given by Hadley for ggplot2 does not seem to work in plotnine.

@has2k1
Copy link
Owner

has2k1 commented Dec 20, 2024

It should work with

annotate("text", -float("inf"), float("inf"), label = "Top-left", ha = "left", va = "top")

@has2k1 has2k1 closed this as completed Jan 5, 2025
@oracle5th
Copy link
Author

Thank you for the quick reply!
Your solution works nicely, but it can only place the annotation at the very corner. If I want it at (0.2, 0.8), so as to leave some space from the corner, I can change the values of hjust and vjust in ggplot2 to achieve that.
image
However, in plotnine, ha and va only support fixed string values. I assume this is a limition of matplotlib. Is there a workaround?

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

No branches or pull requests

2 participants