Menu

#7 Error when trying to plot since instation of Matplotlib 2.0

v1.0 (example)
closed
None
5
2019-05-23
2017-02-26
Omer Tzuk
No

I work with Anaconda environment, and after I updated the Matplotlib version to 2.0, I got this error after trying to plot a bifurcation diagram:

....
File "...../anaconda2/lib/python2.7/site-packages/matplotlib/ticker.py", line 1761, in _raw_ticks
    istep = np.nonzero(steps >= raw_step)[0][0]
IndexError: invalid index to scalar variable.

Discussion

  • Leonardo Gordillo

    Have you solved the problem? I also have it. I tried to downgrade the matplotlib but it did not work either. Any progress?

     
    • Omer Tzuk

      Omer Tzuk - 2017-04-22

      No...I reinstalled python with Matplotlib 1.5, and auto again and it works as previously, but I did not manage to make auto work with Matplotlib 2.0

       
  • Leonardo Gordillo

    Thanks for your answer Omer. I spent a few days trying to install AUTO in Mac OS X Sierra.
    Typical errors I bumped into after plotting in AUTO were:

    > Exception in Tkinter callback
    > Traceback (most recent call last):
    >   File "/anaconda/lib/python2.7/lib-tk/Tkinter.py", line 1536, in __call__
    >     return self.func(*args)
    

    or

    //anaconda/lib/python2.7/site-packages/numpy/core/fromnumeric.py:2507: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.
      VisibleDeprecationWarning)
    

    or

    python[88670:3184728] setCanCycle: is deprecated.  Please use setCollectionBehavior instead
    

    After your suggestion, I finally could get AUTO working properly. I did:

    1) Download and install Anaconda-2.3.0 (newer packages didn't work properly)
    (Anaconda-2.3.0-MacOSX-x86_64.pkg from https://repo.continuum.io/archive/)
    2) Downgrade tk and numpy packages of conda installation
    >> conda install tk=8.5.13
    >> conda remove bottleneck
    >> conda install numpy=1.8
    (matplotlib in this Anaconda release is 1.4.0):
    3) Then proceed with normal AUTO execution.

     
  • Sergey Kirpichev

    Could you try https://sourceforge.net/p/auto-07p/patches/2/ ?

    I have managed to make auto-07p & matplotlib v2.2.3 working with this little patch.

     
    • Omer Tzuk

      Omer Tzuk - 2018-12-08

      Hello Sergey,

      I've recently tried to use the patch (commenting out the line you've mentioned), but I get an error message like this:
      ValueError: all the input arrays must have same number of dimensions

       
  • Parul Verma

    Parul Verma - 2018-10-05

    Hello,

    I am also facing matplotlib related errors. When I try using PyPlaut, I get the following:

    Traceback (most recent call last): File "/home/parul/Software/AutoForLinux/auto/07p/python/graphics/pyplaut.py", line 605, in <module> runner = PyPlautInteractiveConsole(exportFunctions(), b, s) File "/home/parul/Software/AutoForLinux/auto/07p/python/graphics/pyplaut.py", line 82, in __init__ self.handle.config(**dict) File "/home/parul/Software/AutoForLinux/auto/07p/python/graphics/windowPlotter.py", line 211, in config rval = self.grapher.config(cnf,**kw) File "/home/parul/Software/AutoForLinux/auto/07p/python/graphics/plotter.py", line 236, in config self._plotNoDraw() File "/home/parul/Software/AutoForLinux/auto/07p/python/graphics/plotter.py", line 343, in _plotNoDraw self.__plot7(*columns) File "/home/parul/Software/AutoForLinux/auto/07p/python/graphics/plotter.py", line 607, in __plot7 self.__plot7branch(branch,xcolumns,ycolumns,zcolumns) File "/home/parul/Software/AutoForLinux/auto/07p/python/graphics/plotter.py", line 554, in __plot7branch xy = branch.coordarray[col] File "/home/parul/Software/AutoForLinux/auto/07p/python/bifDiag.py", line 229, in __getattr__ return super(bifDiagBranch, self).__getattr__(attr) File "/home/parul/Software/AutoForLinux/auto/07p/python/parseB.py", line 297, in __getattr__ self.__parse() File "/home/parul/Software/AutoForLinux/auto/07p/python/parseB.py", line 343, in __parse stability = self.__parsenumpy(points) File "/home/parul/Software/AutoForLinux/auto/07p/python/parseB.py", line 372, in __parsenumpy [len(points)-1])) ValueError: all the input arrays must have same number of dimensions

    I get these errors after using the patch that you mentioned.
    I am using Python 2.7.12 and matplotlib 1.5.1. My OS is Ubuntu 16.04 LTS.

     
  • D A

    D A - 2019-02-07

    This patch seems to fix that particular issue, it looks as though parseB.py expects numpy to concatenate to an empty array which fails. There's definitely a better way to do this, but as a quick and dirty fix we can just catch the error and return the expected result.

    371c371,372
    <         stab = N.concatenate((N.nonzero(N.less(points[:-1]*points[1:],0)),
    ---
    >   try:
    >           stab = N.concatenate((N.nonzero(N.less(points[:-1]*points[1:],0)),
    372a374,375
    >   except ValueError:
    >       stab = N.array([len(points)-1])
    
     
  • Bart Oldeman

    Bart Oldeman - 2019-05-23

    It's a combination of not overriding N.nonzero (because that is now used by matplotlib itself) but also explicitly using N.flatnonzero in the AUTO python code, as done here:
    https://github.com/auto-07p/auto-07p/commit/df84ddbc79ae86f13d5840f3c6cdfdfe56b7936a
    it's now fixed in that github repository.

     
  • Bart Oldeman

    Bart Oldeman - 2019-05-23
    • status: open --> closed
    • assigned_to: Bart Oldeman
     

Log in to post a comment.