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

type error at end of ajust_text #42

Closed
EisFranzi opened this issue Apr 17, 2018 · 6 comments
Closed

type error at end of ajust_text #42

EisFranzi opened this issue Apr 17, 2018 · 6 comments

Comments

@EisFranzi
Copy link

I was trying your examples. Everything worked well except at the end I get the error:

File "C:\Python27\lib\site-packages\adjustText\adjustText.py", line 563, in adjust_text
return i+1
TypeError: can only concatenate tuple (not "int") to tuple

This actually prevents the image from being saved with a plt.savefig() command.
I did not install pandas. Is that a prerequisite?

Thanks for paying attention!

@Phlya
Copy link
Owner

Phlya commented Apr 17, 2018 via email

@EisFranzi
Copy link
Author

I tried some examples from https://github.com/Phlya/adjustText/wiki and just added a save command at the end. The image does not get saved because of the error message mentioned before.

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

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, ha='center', va='center') for i in range(len(x))]
adjust_text(texts)
plt.savefig('C:/Users/nehring/Desktop/Austausch/test.png')_

@Phlya
Copy link
Owner

Phlya commented Apr 22, 2018

I'm closing this as fixed by @colinmorris, let me know if it isn't. Thanks!

@Phlya Phlya closed this as completed Apr 22, 2018
@aqshaw
Copy link

aqshaw commented Apr 25, 2018

Hi

I've been having a similar issue, even without a save command, and when save_steps = False.

I get a type error when running the following code:

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, ha='center', va='center') for i in range(len(x))]
adjust_text(texts,save_steps = False)
plt.show()

@Phlya
Copy link
Owner

Phlya commented Apr 25, 2018

Hi, have you tried upgrading from the repo? I don't think I have pushed this to PyPI yet...

@aqshaw
Copy link

aqshaw commented Apr 26, 2018

Hi.

I did try, but I had another go. This time I uninstalled the PyPl first, and then installed from the repo. That seems to have done it.

Sorry to take up your time on something silly.

Thanks

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