- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Plot mean and standard deviation in Matplotlib
First, we can calculate the mean and standard deviation of the input data using Pandas dataframe.
Then, we could plot the data using Matplotlib.
Steps
Create a list and store it in data.
Using Pandas, create a data frame with data (step 1), mean, std.
Plot using a dataframe.
To show the figure, use plt.show() method.
Example
import pandas as pd from matplotlib import pyplot as plt data = [-5, 1, 8, 7, 2] df = pd.DataFrame({ 'data': data, 'mean': [2.6 for i in range(len(data))], 'std': [4.673328578 for i in range(len(data))]}) df.plot() plt.show()
Output
- Related Articles
- Box plot with min, max, average and standard deviation in Matplotlib
- How to create boxplot using mean and standard deviation in R?
- How to find mean and standard deviation from frequency table in R?
- Generate random numbers by giving certain mean and standard deviation in Excel
- PyTorch – How to normalize an image with mean and standard deviation?
- How to compute the mean and standard deviation of a tensor in PyTorch?
- Variance and Standard Deviation
- How to create a line chart with mean and standard deviation using ggplot2 in R?
- Python Pandas - Draw a bar plot and show standard deviation of observations with Seaborn
- Python Pandas - Draw a point plot and show standard deviation of observations with Seaborn
- Difference Between Beta and Standard Deviation
- Absolute Deviation and Absolute Mean Deviation using NumPy
- Application of Variance and Standard Deviation in Psychology
- Average Returns and Standard Deviation of Securities
- How to calculate standard deviation in Excel?

Advertisements