Skip to content

the program written in spyder3.3.3 can't run in spyder3.3.6 #15120

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

Closed
fanzz1982 opened this issue Aug 25, 2019 · 3 comments
Closed

the program written in spyder3.3.3 can't run in spyder3.3.6 #15120

fanzz1982 opened this issue Aug 25, 2019 · 3 comments

Comments

@fanzz1982
Copy link

fanzz1982 commented Aug 25, 2019

Bug report

the program .py written in spyder3.3.3 can't run in spyder3.3.6. It seems that the command axes[].plot() from matplotlib has sth wrong in spyder3.3.6. The alarm messenge is : tuple index out of range
I report the probelm to the admin of spyder. He reply me that it is the problem in matplotlib not in spyder, and I should update my code.
What can I do about updating my code? my matplotlib in anaconda is 3.1.0
Bug summary
It seems that the command axes[].plot() from matplotlib has sth wrong in spyder3.3.6. The alarm messenge is : tuple index out of range

Code for reproduction

# Paste your code here
#
#
for i in range(n):
    irf_data = pd.DataFrame(
            [irf_1[:,i], irf_2[:,i], irf_3[:,i]]).T
    irf_data.columns = ['point', 'up', 'lower']
    
    axes[i//2, i % 2].plot(irf_data.index, irf_data.1,
                           color = 'blue', linestyle = '-')

Actual outcome
tuple index out of range

Expected outcome

Matplotlib version

  • Operating system:
  • Matplotlib version:
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:
@jklymak
Copy link
Member

jklymak commented Aug 25, 2019

Can you make a self contained complete runnable example that shows the issue? Also report the full trace back? And your matplotlib version (at the very least) and maybe the previous matplotlib version?

@fanzz1982
Copy link
Author

fanzz1982 commented Aug 25, 2019

Can you make a self contained complete runnable example that shows the issue? Also report the full trace back? And your matplotlib version (at the very least) and maybe the previous matplotlib version?

When the problem occurs, my matplotlib in anaconda is 3.1.0. Then I reinstall the anaconda, and the spyder is 3.3.3, matplotlib is 3.0.3, the .py runs well.

n=9
irf_1 = np.random.uniform(0,1,(100,9))
irf_2 = np.random.uniform(0.5,1.5,(100,9))
irf_3 = np.random.uniform(-0.5,0.5,(100,9))
fig, axes = plt.subplots((n+1) // 2, 2)
for i in range(n):
    irf_data = pd.DataFrame(
            [irf_1[:,i], irf_2[:,i], irf_3[:,i]]).T
    irf_data.columns = ['point', 'up', 'lower']
    
    axes[i//2, i % 2].plot(irf_data.index, irf_data.point,
                           color = 'blue', linestyle = '-')
    axes[i//2, i % 2].plot(irf_data.index, irf_data.up,
                           color = 'red', linestyle = '--')
    axes[i//2, i % 2].plot(irf_data.index, irf_data.lower,
                           color = 'red', linestyle = '--')
plt.show()

@ImportanceOfBeingErnest
Copy link
Member

ImportanceOfBeingErnest commented Aug 25, 2019

This is most probably a duplicate of #14992 and fixed by #15007 (on the matplotlib side) and/or pandas-dev/pandas#27818 (on the pandas side).

What this means is that matplotlib 3.1.1 or lower is not compatible with pandas 0.25.0 when plotting the index of a dataframe.

Options are:

  • Use numpy arrays (matplotlib tries to support pandas as good as possible, but there are still some hickups every now and then)
  • Wait for matplotlib 3.1.2 to be released.
  • Use pandas 0.24.x or 0.25.1 (once it's released)

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

3 participants