omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Bug in Matplotlib?

    Pythonista
    4
    10
    3957
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ihf
      ihf last edited by

      I took this script from a matplotlib tutorial. It crashes Pythonista (latest beta) on an iPad Pro.

      import matplotlib.pyplot as plt
      import numpy as np
      x = np.linspace(0, 2, 100)

      plt.plot(x, x, label='linear')
      plt.plot(x, x2, label='quadratic')
      plt.plot(x, x
      3, label='cubic')

      plt.xlabel('x label')
      plt.ylabel('y label')

      plt.title("Simple Plot")

      plt.legend()

      plt.show()

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @ihf last edited by cvp

        @ihf typing error, code is

        import matplotlib.pyplot as plt
        import numpy as np
        
        x = np.linspace(0, 2, 100)
        
        plt.plot(x, x, label='linear')
        plt.plot(x, x**2, label='quadratic')
        plt.plot(x, x**3, label='cubic')
        
        plt.xlabel('x label')
        plt.ylabel('y label')
        
        plt.title("Simple Plot")
        
        plt.legend()
        
        plt.show()
        

        see here

        1 Reply Last reply Reply Quote 0
        • ihf
          ihf last edited by ihf

          @cvp I guess the double ** is treated as a formatter. In any case, the script crashes Pythonista.

          cvp 1 Reply Last reply Reply Quote 0
          • cvp
            cvp @ihf last edited by

            @ihf I don't have any problem

            1 Reply Last reply Reply Quote 0
            • ihf
              ihf last edited by

              Yes that is what it should look :-) It crashes Pythonista immediately on my iPad running the current beta. Is that what you are running?

              cvp 1 Reply Last reply Reply Quote 0
              • cvp
                cvp @ihf last edited by

                @ihf You are right: if I force a run in Python 2.7, it crashes

                Fatal Python error: Aborted
                
                Thread 0x000000016f2e3000 (most recent call first):
                
                1 Reply Last reply Reply Quote 0
                • ihf
                  ihf last edited by

                  Yet another reason to run 3.6 rather than 2.7. BTW, where did you find the error msg? Is there a crash log?

                  cvp 1 Reply Last reply Reply Quote 0
                  • cvp
                    cvp @ihf last edited by

                    @ihf pythonista_startup from @dgelessus see here

                    1 Reply Last reply Reply Quote 0
                    • omz
                      omz last edited by

                      I apologize for this bug, this is in no way meant to force anyone to upgrade to 3.6, but I'd seriously recommend that you get on board with Python 3 quite soon, as it'll ensure that your code will continue to run without problems in the future.

                      I don't think that I'll remove Python 2.7 support from Pythonista in the near future, but a lot of new features require Python 3 already.

                      1 Reply Last reply Reply Quote 1
                      • mikael
                        mikael last edited by

                        Also, now less than a year until Python 2 becomes unsupported by core developers, so no reason to build anything new on it.

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        Powered by NodeBB Forums | Contributors