Module in Python


Hi! This tutorial will introduce and discuss the module in Python.

Here is an overview:

Let’s get into the discussion!


What is Module?

The module is a high-level Python module that simplifies the process of creating interactive visualizations. It is built on top of plotly, a popular open-source graphing library, and provides an easy-to-use interface for creating a wide range of charts, from simple scatter plots to complex 3D visualizations.

Key Features of Module

The key features of include the following:

  • Simple API for creating visualizations.
  • Interactive plots that allow users to zoom, pan, and explore data.
  • Customization options for appearance and styling.
  • Support for a variety of chart types, including scatter plots, bar charts, heatmaps, and more


Installation of Module

To use the module, we first need to install it. Therefore, in your Python programming IDE or code editor, run the line of code below to install

pip install plotly

Pip stands for “Pip Installs Packages” or “Pip Installs Python”. So, by running pip install plotly, pip will automatically download and install and its dependencies from the Python Package Index (PyPI).

We can then import the module by running the line of code below:

import as px

So, with the module installed and imported into our Python programming environment, we can now build some basic charts.

Basic Charts

Here, we will build some basic charts. We will begin with a histogram:

df =
fig = px.histogram(df, x="day", y="tip", color="sex", title="Total Tip by Gender")

In the above example, we first used method to load the tips dataset, which we assigned to df.

Thereafter, we passed the DataFrame to px.histogram() method and defined the x axis as the day column of the DataFrame; the y axis as tip; and color as sex.

We also added a plot title, and finally displayed the plot using method.

You can load different datasets that come preloaded in the module by simply typing which will bring up all the available datasets that you can choose from.

Next, we will build a simple scatter plot:

df =
fig = px.scatter(df, x="petal_width", y="sepal_length", color="species", title="Petal Width vs Sepal Length")

In this example, we used the popular iris dataset to build a scatter plot.

First, we loaded the dataset like we did in the last example. Then, we used the px.scatter() method to draw the scatter plot.

In the method, we defined the x axis as the petal_width column of the DataFrame; the y axis as sepal_length; and the colors as species. Then we added a plot title.

These are just two examples of the many kinds of visualizations you can build using the module.

Interactive Features

One of the standout features of is its interactivity. By default, you can zoom, pan, and hover to see additional information.

  • Hover Information: You can hover over data points to display additional information.
  • Zooming and Panning: You can use the mouse to zoom in on specific areas of your chart and pan to navigate large datasets.


You can also save visualizations as HTML files or images, making it easy to share your insights with others.

The module is a versatile and user-friendly module for data visualization in Python. It simplifies the process of creating interactive and informative charts, making it a valuable tool for data analysis and presentation.

Whether you are a data scientist, analyst, or researcher, can help you convey your insights effectively.

Video, Further Resources & Summary

Do you need more explanations on the module in Python? Then you should have a look at the following YouTube video of the Statistics Globe YouTube channel.

In the video, we explain the module in Python in some more detail.


The YouTube video will be added soon.


With that, we have discussed and understood the Python module. Furthermore, you could have a look at some of the other interesting Python plotly tutorials on Statistics Globe:

This post has shown what the module in Python is. I hope you found this tutorial post helpful! In case you have further questions, you may leave a comment below.


R & Python Expert Ifeanyi Idiaye

This page was created in collaboration with Ifeanyi Idiaye. You might check out Ifeanyi’s personal author page to read more about his academic background and the other articles he has written for the Statistics Globe website.


Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.

Leave a Reply

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

Fill out this field
Fill out this field
Please enter a valid email address.