What it does

grid-strategy is a tool for developers to make plotting multiple figures very easy. You simply have to specify how many graphs are wanted and it will automatically place them in an organized manner. This year, we added two new features. The first gives the users the option to specify an aspect ratio they want for the graphs, adding a little more flexibility to the shape of the grid. The second feature makes the library backend agnostic, so developers are not restricted to using matplotlib. This year we added support for bokeh, since it uses html plots for graphing as opposed to matplotlibs native figures. This also allows users to add their own backends using an abstract class so they are not forced to use the plotting libraries that we support.

Accomplishments I'm Proud Of

We are most proud of the fact that grid-strategy is part of the matplotlib organization and is live on PyPI, so anybody can use it. This time, we successfully got our additions merged in and they are visible in the main github repo.


Our inspiration came from the want to give the user more flexibility when using our library. Before, the library would always try to make the grids as square as possible and giving the user the choice improves this library significantly. The dependence on matplotlib was also restricting since matplotlib is not appropriate for every situation, and fixing this was something that we have wanted to do for about a year now.

How I built it

If the user asks for n grids, the aspect ratio algorithm will look for the factors of n that are closest the the aspect ratio passed in. For the backend, I decoupled it by creating a backends submodule that has a class for each backend that is supported. Currently there is Matplotlib and Bokeh, both of which return objects that accept functions and can be plotted.

Challenges we ran into

One of the main problems we encountered came from the testing framework we are using. Since grid-strategy is part of the matplotlib organization, there are requirements for code coverage and testing. None of us know much about these topics so we struggled to figure it out. Eventually, we came to the realization that out coverage framework changed its format from last year and it was breaking all of our test cases. Our mentor said he would look into a solution for us and in the mean time, we have removed the broken test cases and successfully merged our additions into the matplotlib organization.

What's next

The immediate problem is the current state of the code in the repo. Our mentor wants us to change it from a stringly typed api to one that is more static using Python's typed library. Another problem is with the backend module, as there is some code duplication that can be mitigated still. After these problems have been solved, we plan to add more support for different backends like plotly and altair.

Built With

Share this project: