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.

Advertisements
  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: