Home > backend, GSOC2015, kivy, matplotlib > Kivy matplotlib backend with right text positioning and rendering.

Kivy matplotlib backend with right text positioning and rendering.

In order to fix the problem of the layout of the text inside the canvas, an important function had to be overwritten with the information of the bounding box for each text inside it. The function is get_text_width_height_descent in this, one calculates the width and height and return them. Inside matplotlib these values are important to calculate the positioning of the elements according to the layout set by the user. Additionally, in the draw_text method transformations and styling is applied to the text. At the end we can have a working backend with different fonts and styles that are mapped between matplotlib and kivy capabilities.

Another inconvenient in the rendering of the graphs were some glitches while drawing. I was calculating u and v to create the mesh for the polygons when this was not really necessary. After some debugging and analysis of the vertices the final implementation generate the meshes and lines for all the elements in the canvas as follow:

Screenshot from 2015-07-07 12:18:28 example mpl kivy

As can be seen, now it is getting closer to how the static image implementation looks like from the previous post.

  1. No comments yet.
  1. No trackbacks yet.