Skip to content

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

Closed

Description

@fanzz1982

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:

Activity

  1. jklymak commented on Aug 25, 2019

    @jklymak
    Member

    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?

  2. fanzz1982 commented on Aug 25, 2019

    @fanzz1982
    Author

    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()
    
  3. ImportanceOfBeingErnest commented on Aug 25, 2019

    @ImportanceOfBeingErnest
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions