Plotly is a popular open source interactive data visualization tools that allow you create visualizations or charts to understand your data. Plotly has over 40 different types of charts for statistics, geographics, science, finance, regression etc

Built on top of the Plotly JavaScript library (plotly.js), Plotly enables Python users to create beautiful interactive web-based visualizations that can be displayed in Jupyter notebooks, saved to standalone HTML files, or served as part of pure Python-built web applications using Dash. The plotly Python library is sometimes referred to as “” to differentiate it from the JavaScript library. Source: Plotly

Plotly VS Matplotlib

Plotly and matplotlib are both popular and the most used Python libraries for data visualization. On one hand, matplotlib is mostly used to create static, and with the help of add on you can create interactive and animated visualisation for professional publication or presentation.

On the other hand, Plotly is a great Python library for creating interactive and animated visualization for geography, science, statistics and finance data which can be used for professional presentation, shared, and easily embedded in web pages.

Additionally, in functionality, matplotlib is more flexible but requires adequate knowledge to use effectively, while plotly has a wide range of prebuilt visualisation that are user friendly.

There are 3 basic components of Plotly:

Install Plotly:

We can use either Conda or PyPI to install Plotly


	$ pip install plotly==5.11.0


	$ conda install -c plotly plotly=5.11.0

Build a simple chart with Plotly


  • JupyterHub notebook or use deepnote

  • Python

Dataset: Click here to download the Kaggle dataset

	import pandas as pd  

	import as px  
    # read data with pandas  
    df = pd.read_csv("data1.csv")  
    # get top 50 rows  
    df = df[0:50]  
    # use plotly express to visualize countires with their school ranks and points  
    import as px  
    fig ="Country",y="Point",data_frame=df,color="Rank")

The output of this code will produce a chart

Plotly chart

Additional resources: