Data Visualization using Plotly
Box Plot in Jupyter Notebook
Box plot is a graphical represntation of dataset and is usally used to find the outliers in the dataset. Box are much beneficial for comparing the groups of data. To plot a box plot we will use plotly library.
Follow the below steps to use scatter graph in you Jupyter Notebook:
- import the plotly module
- Load the data set using px.data.dataset_name() method
- Use box() method to plot the box plot
- use show() method to show the figure
Example:
Python3
import plotly.express as px df = px.data.iris() fig = px.box(df, x = "sepal_width" , y = "sepal_length" ) fig.show() |
Output:
Histogram in Jupyter Notebook
Histogram is used to graphically represent the data and typically used in statistics to compare the historical data. To plot a histogram we will use Plotly library.
Follow the below steps to use scatter graph in you Jupyter Notebook:
- import the plotly module
- Load the data set using px.data.dataset_name() method
- Use histogram() method to plot the box plot
- use show() method to show the figure
Example:
Python3
import plotly.express as px df = px.data.tips() fig = px.histogram(df.total_bill) fig.show() |
Output:
Conclusion
In the article we discussed the widely used graphs and charts in the data visualization there are other graphs also available which you can checkout here.
Data Visualization in jupyter notebook
In this article, we will learn how to visualize data in Jupyter Notebook there are different libraries available in Python for data visualization like Matplotlib, seaborn, Plotly, GGPlot, Bokeh, etc. But in this article, we will use different libraries like Matplotlib, searborn, and Plotly which are widely used for data visualization. We will generate different graphs and plots in Jupyter Notebook using these libraries such as bar graphs, pie charts, line charts, scatter graphs, histograms, and box plots. We will also discuss how to install these libraries and use examples to understand each graph.
Jupyter Notebook
The Jupyter Notebook is the original web application for creating and sharing computational documents that contain live code, equations, visualizations, and narrative text. It offers a simple, streamlined, document-centric experience. Jupyter has support for over 40 different programming languages and Python is one of them.
Prerequisites
In this article, we will use different libraries to create graphs and plots and you have to install the library to function the below example you can use the following code snippetes to install the dependencies.
Install matplotlib
pip install matplotlib
Install Seaborn
pip install seaborn
Install Plotly
pip install plotly