DataScienceToday is a new online plateform and going source for data science related content for its influential audience in the world . You can reach us via email
contact@datasciencetoday.net
datasciencetoday.net@gmail.com
made by Bouchra ZEITANE , Zaineb MOUNIR
under the supervision of Pr. Habib BENLAHMAR
How to make great-looking, fully-interactive plots with a single line of Python
The sunk-cost fallacy is one of many harmful cognitive biases to which humans fall prey. 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 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.
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. This complication leads to hours of frustration on StackOverflow figuring out how to format dates or add a second y-axis. 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.In this article, we’ll dive right into plotly
, learning how to make better plots in less time — often with one line of code.
All of the code for this article is available on GitHub. The charts are all interactive and can be viewed on NBViewer here.