Home > GSOC2015, kivy, matplotlib > Matplotlib for Kivy Final Notes

Matplotlib for Kivy Final Notes

As outcome of one of the projects from the google summer of code 2015 two packages were created and are available as kivy garden packages.

These two packages can be used separately or can be combined as shown in https://andnovar.wordpress.com/2015/08/06/corner-detection-on-strokes-and-strokes-annotations-on-matplotlib/.

Warning:

– If you are using dash_list attribute when creating a line in a figure, it will not work until the update is done in the next kivy version.
– The backend only works with the kivy >= 1.9.1. Some changes were done in the Widget class.
– Matplotlib backend has not been tested on android.

Both packages have been tested and debugged, however it is highly encouraged to submit any issue found while using them. Some of its advantages and weaknesses are exposed in the following paragraphs:

The first package is garden.matplotlib which is a matplotlib backend for kivy, it allows to create applications using pyplot instructions or to embed figures into a kivy application. There are two possible backends that can be invoked:

– backend_kivy which does the render using kivy graphics instructions.
– backend_kivyagg which does the render using an static image texture.

Both of the backends can be connected to the default matplotlib events https://andnovar.wordpress.com/2015/06/15/connecting-events-between-kivy-and-matplotlib/. Additionally another widget called NavigationToolbar can be instantiated and used with both backends, a better description can be found in https://andnovar.wordpress.com/2015/08/06/navigation-toolbar-with-matplotlib-events-connected/. A FigureCanvas can be used without a NavigationToolbar but a NavigationToolbar needs a FigureCanvas to be instantiated. The main advantage of this package is the ability to be added as another Kivy widget inside a Kivy application through the use of matplotlib instructions.

There are some features that were not implemented and the users should be aware of:

– backend_kivy and backend_kivyagg are non interactive backends (http://matplotlib.org/faq/usage_faq.html#what-is-interactive-mode)
– gouraud shading in backend_kivy
– configure_subplots button in the NavigationToolbar is not implemented.

Known bugs:

– When zooming on an area with not enough graphics instructions the render is not properly done. https://github.com/andnovar/kivy/issues/72

In the same way there are some features implemented in backend_kivy that are not implemented in other graphics instructions based backends.

– clip path when rendering an image.
– draw_path_collection method for optimization.
– draw_markers for optimization.

We believe most of matplotlib current capabilities have been considered during this backend implementation. However, we encourage to submit any capability missed you may find.

Advertisements
Categories: GSOC2015, kivy, matplotlib Tags: , ,
  1. No comments yet.
  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: