omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. twotoed
    3. Topics

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 4
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by twotoed

    • twotoed

      Installing matplotlib-venn issues
      Pythonista • • twotoed

      5
      0
      Votes
      5
      Posts
      4594
      Views

      Matteo

      @twotoed Hi, do not be discouraged, Pythonista is great, it is maintained by one person and for this reason can't be compared to a PC python environment (don't forgive the limits imposed by Apple about a lot of things...).

      Anyway, as @dgelessus and @JonB suggested, a good way is to install in Pythonista the library you need, if it is impossible download and extract it in Pythonista site-package folder. Then find, inside the installed lib you want to use, all names of libraries not installable in Pythonista, like scipy, and comment them: you must find alternatives (in most cases you need to search internet for numerical recipes or for pure-python libs).

      I know, in python world I'm also frustrated when I must download a big python lib even if I use only 3% of all features available in that lib.

      About the lib matplotlib-venn, the only scipy request is, as @JonB pointed, a numerical root solver that is brentq, that you can replace with a similar one Pythonista has in built-in mpmath lib.

      A solution using function findroot that you find in mpmath lib (already implemented in Pythonista) is:

      open _math.py in main folder of matplotlib-venn comment the scipy importing and adding in place of it: from mpmath import * where you find the command: return brentq(lambda x: circle_intersection_area(r, R, x) - a, R - r, R + r) modify it by writing return findroot(lambda x: circle_intersection_area(r, R, x) - a, R) where R is the average between 'R-r' and 'R+r' of the brentq function. save _math.py

      Now you should be able to run the folowing test example that I found in Stackoverflow:

      import matplotlib.pyplot as plt from matplotlib_venn import venn3, venn3_circles v = venn3(subsets=(1,1,0,1,0,0,0)) v.get_label_by_id('100').set_text('First') v.get_label_by_id('010').set_text('Second') v.get_label_by_id('001').set_text('Third') plt.title("Not a Venn diagram") plt.show()

      Bye
      Regards

    • twotoed

      How to update sympy on ios
      Pythonista • • twotoed

      3
      0
      Votes
      3
      Posts
      2679
      Views

      twotoed

      Thanks for that. I think I've now managed to update to the latest version.

      Just in case anyone else wants to do something similar in future, here's what I did:
      Installed stash: here
      Then in stash: pip install sympy
      There seemed to be a few error messages but checking the version using: import sympy ; print(sympy.__version__) seems to show the latest version so that's great.

      Again, thanks for the help.