Home > kivy, matplotlib > Matplotlib backend kivy in Windows hands on

Matplotlib backend kivy in Windows hands on

The backend implementations for matplotlib in kivy work just with kivy versions greater or equal than 1.9.1. It is required to install kivy in development mode following these steps: http://kivy.org/docs/installation/installation-windows.html#use-development-kivy. After step 10 you can additionally run


python setup.py install

The script kivy.bat creates an environment in which some python tools are ready to use, for instance pip. The next step is to download numpy and matplotlib from this binaries repositories: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy and http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib. Once downloaded install both using pip and then install kivy-garden and the matplotlib package for kivy.


pip install "numpy-1.10.0b1+mkl-cp27-none-win32.whl"
pip install "matplotlib-1.4.3-cp27-none-win32.whl"
pip install kivy-garden
garden install matplotlib

You can go now to the folder that by default garden packages are installed. In my case C:\Users\my_user\.kivy\garden\


cd garden.matplotlib/examples
python test_plt.py

And you should be able to see the matplotlib widget working on windows. Follow the steps from http://kivy.org/docs/installation/installation-windows.html#send-to-method to create a shortcut to execute your kivy apps.

Now you can go directly to the garden path using a file explorer, do right click on test_plt.py and send to kivy-2.7.bat which will start the application.

Advertisements
Categories: kivy, matplotlib Tags: , ,
  1. David
    September 4, 2015 at 4:26 am

    Hi Andnovar

    Thanks for these instructions. I understand that ‘python setup.py install’ installs a Python Package from source. Which package is being installed here?

    David

    • September 4, 2015 at 5:21 am

      Hello, the package installed is this one: http://kivy.org/downloads/1.9.0/Kivy-1.9.0-py2.7-win32-x86.exe. Then master https://github.com/kivy/kivy/archive/master.zip is renamed and replaced for the kivy-27 folder and reinstalled following the steps from the development kivy section. Similar with the other windows packages.

      • David
        September 4, 2015 at 6:38 am

        Thanks for answering my question.

        I now have matplotlib successfully installed and I can run test_plt.py. Please could you provide an example that draws the plot on a widget (eg Boxlayout) specified by a .kv file? That would be closer to what I want to do.

  2. David
    September 11, 2015 at 4:33 am

    Hi Andnovar

    Please will you add some installation notes for Linux?

    David

  3. September 11, 2015 at 5:45 am

    Hi David, for linux you can read the source code documentation (https://github.com/kivy-garden/garden.matplotlib/blob/master/backend_kivy.py), certainly I will move that to the readme of the garden package to make it more visible. If using linux after installing kivy and matplotlib you would need to install the garden as explained here: http://kivy.org/docs/api-kivy.garden.html .

    garden install matplotlib

    or

    garden install –app matplotlib

    should make it and you would be able to use the kivy.garden.matplotlib in your app. I will write a post about this from a fresh ubuntu installation later on.

    • David
      September 14, 2015 at 10:05 am

      Hi Andnovar

      I’m really struggling to get this working on Fedora (it’s fine on Windows). I would be very grateful if you could provide some instructions for Linux please, even if it’s for Ubuntu.

      Best regards

      David

      • September 14, 2015 at 10:15 am

        David I will write a post for linux np.

  4. Aleh
    July 8, 2016 at 12:01 am

    plz could you show as how to plot the function (sin) using garden.pyplot

  5. Lídia
    September 21, 2016 at 7:55 am

    Hi , this error appears to me. Any idea how to solve?

    File “”, line 1163, in _load_backward_compatible
    KeyError: ‘kivy.garden.matplotlib’

    thanks

  6. Lídia
    September 21, 2016 at 7:56 am

    Hi, this error appears to me. Any idea how to solve?

    File “”, line 2237, in _find_and_load
    File “”, line 2226, in _find_and_load_unlocked
    File “”, line 1191, in _load_unlocked
    File “”, line 1163, in _load_backward_compatible
    KeyError: ‘kivy.garden.matplotlib’

    Thanks

    • September 21, 2016 at 12:57 pm

      I need to know more information. Are you running the examples that come with the package ? Which Kivy version are you using ?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: