Option FanaticOptions, stock, futures, and system trading, backtesting, money management, and much more!

Debugging Matplotlib (Part 1)

Matplotlib is giving me fits. In this blog mini-series, I will go into the What and try to figure out the Why.

The matplotlib website says:

        > Matplotlib is a comprehensive library for creating static, animated, and interactive
        > visualizations in Python. Matplotlib makes easy things easy and hard things possible.

The DataCamp (DC) website says:

        > Luckily, this library is very flexible and has a lot of handy, built-in defaults that
        > will help you out tremendously. As such, you don’t need much to get started: you
        > need to make the necessary imports, prepare some data, and you can start plotting
        > with the help of the plot() function! When you’re ready, don’t forget to show your
        > plot using the show() function.
        >
        > Look at this example to see how easy it really is…

I have found matplotlib to be the antithesis of “easy.” I am more in agreement with this previous DC paragraph:

        > At first sight, it will seem that there are quite some [sic] components to consider
        > when you start plotting with this Python data visualization library. You’ll probably
        > agree with me that it’s confusing and sometimes even discouraging seeing the
        > amount of code that is necessary for some plots, not knowing where to start
        > yourself and which components you should use.

Using matplotlib is confusing and certainly discouraging. Many things may be done in multiple ways, and compatibility is not made clear. Partially as a result, I think some things do absolutely nothing. Support posts are available on websites like Stack Overflow, Stack Abuse, Programiz, GeeksforGeeks, w3resource, Python.org, Kite, etc. Questions, answers, and tutorial information spans over a decade. Some now “deprecated” solutions no longer work. Also adding to the confusion are some solutions that may only work in select environments, which is not even something I see discussed.

What I do see discussed is how easy and elegant matplotlib is to use. I seem to be experiencing a major disconnect.

Maybe the difference is the simplicity of the isolated article examples in contrast to the complex application I am trying to implement. Why would my application be more complex than anyone else’s, though? I am trying to develop a research tool where the results are unknown. While different from writing sample code to present already-collected data, that would be a weak excuse. Discovering previously-hidden relationships is a common motivation behind data visualization.

To learn programming with matplotlib, my rough road has left me only one path: debug the process to understand why my previous attempts have failed. That is where I will start next time.

No comments posted.

Leave a Reply

Your email address will not be published. Required fields are marked *