
The Python library is free to use, and we can make unlimited charts in offline mode plus up to 25 charts in online mode to share with the world.)Īll the work in this article was done in a Jupyter Notebook with plotly + cufflinks running in offline mode. ( Plotly itself is a graphics company with several products and open-source tools. So, our entire stack is cufflinks > plotly > plotly.js > d3.js which means we get the efficiency of coding in Python with the incredible interactive graphics capabilities of d3. We’ll be using a wrapper on plotly called cufflinks designed to work with Pandas dataframes. The plotly Python package is an open-source library built on plotly.js which in turn is built on d3.js. The charts are all interactive and can be viewed on NBViewer here.Įxample of plotly figures ( source) Plotly Brief Overview In this article, we’ll dive right into plotly, learning how to make better plots in less time - often with one line of code.Īll of the code for this article is available on GitHub. Fortunately, this is a great time for Python plotting, and after exploring the options, a clear winner - in terms of ease-of-use, documentation, and functionality - is the plotly Python library. This complication leads to hours of frustration on StackOverflow figuring out how to format dates or add a second y-axis.

Over the past few months, I’ve realized the only reason I use matplotlib is the hundreds of hours I’ve sunk into learning the convoluted syntax. The sunk-cost fallacy applies to staying in bad jobs longer than we should, slaving away at a project even when it’s clear it won’t work, and yes, continuing to use a tedious, outdated plotting library - matplotlib - when more efficient, interactive, and better-looking alternatives exist. It refers to our tendency to continue to devote time and resources to a lost cause because we have already spent - sunk - so much time in the pursuit. The sunk-cost fallacy is one of many harmful cognitive biases to which humans fall prey. How to make great-looking, fully-interactive plots with a single line of Python
