Python : Libraries : PANDA, MATPLOTLIB, PLOTY

Can someone guide me on Which Library to use when. I have seen that libraries like ploty, matplotlib, panda all can do plotting, then which one to use when.

Any tutorial on this?

I’m pretty sure Pandas uses Matplotlib under the hood for its plots. Pandas’ plotting functions are more like convenient shortcuts to Matplotlib patterns. Pandas’ focus is really on creating and manipulating dataframes, table-like objects that house data , for working with your data. It makes merging datasets, filtering data, and preparing it for analysis and visualization easier.
Matplotlib is a great general-purpose graphing library. It lets you graph pretty much anything, it’s popular in many circles for creating ‘publication quality’ graphs. Its power comes with some degree of complexity though and is a commitment to learn and use well (this might just be my opinion).
Plotly is similar to Matplotlib in function, it creates graphs/visualizations and will also take some time to learn; but it differs a little on execution and focus. It is more focused on convenience for interactivity, things like web apps with interactive or changing visuals.

Which libraries you use is really dependent on what field and industry you’re in. Generally speaking, if you’re using Python in the data science field you’re also probably using Pandas and Numpy to manipulate your data. So take some time to really learn these libraries well because they let you prepare your data for whatever comes next, be it plotting, modeling, or analysis. The best way to learn Pandas is to first read the docs, then use it. Try kaggle competitions if you’re looking for data science, you’ll get a lot of pandas & matplotlib examples.
Which plotting library you use is largely a product of personal taste and what your peers/coworkers use. Stick with it long enough and you’ll likely know both Matplotlib and Plotly, plus many more. Matplotlib is in a lot of ways “the standard” for data visualizations in Python. There are many tutorials and guides that use it exclusively for plotting. Also, who knows how many other Python libraries exist that use Matplotlib under the hood for built-in plotting methods. It’s almost hard not to learn it at some point for these reasons. Plotly is gaining a lot of traction in industry because it makes building data-driven apps slightly faster. In fact you can import Matplotlib plots into Plotly for things like web deployment. You MAY find it quicker to produce visuals in Plotly that are aesthetically pleasing when compared to Matplotlib, but your mileage may vary.

1 Like