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

Get final text coordinates #112

Open
starfriend10 opened this issue Feb 6, 2021 · 2 comments
Open

Get final text coordinates #112

starfriend10 opened this issue Feb 6, 2021 · 2 comments

Comments

@starfriend10
Copy link

Hi, good package!
Can I get the text coordinates? So I can reuse the coordinate data to plot texts using other packages (not Matplotlib)?
Or, can I use the package without the support of Matplotib?
Thank you.

@witwall
Copy link

witwall commented Dec 6, 2021

import matplotlib.pyplot as plt
from adjustText import adjust_text
import numpy as np
import pandas as pd

np.random.seed(0)
x, y = np.random.random((2,30))
fig, ax = plt.subplots()
plt.plot(x, y, 'bo')
texts = [plt.text(x[i], y[i], 'Text%s' %i) for i in range(len(x))]
print(texts)
adjust_text(texts)
print(texts)

you will find two different result , and the final one is what you want.

@Phlya
Copy link
Owner

Phlya commented Feb 27, 2023

While the actual issue is solved with above, I'm curious about the possibility adjustText could be used in other packages @starfriend10 could you clarify your usecase? With the new engine it will be very simple to move just the logic into a separate function that could be used for any similar situation.

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

No branches or pull requests

3 participants