

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Questions & Answers
- Box plot with min, max, average and standard deviation in Matplotlib
- How to create boxplot using mean and standard deviation in R?
- Variance and Standard Deviation
- How to find mean and standard deviation from frequency table in R?
- PyTorch – How to normalize an image with mean and standard deviation?
- How to compute the mean and standard deviation of a tensor in PyTorch?
- Absolute Deviation and Absolute Mean Deviation using NumPy
- How to create a line chart with mean and standard deviation using ggplot2 in R?
- Average Returns and Standard Deviation of Securities
- 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
- C++ Program to Calculate Standard Deviation
- What is Standard Deviation of Return?
- Java Program to Calculate Standard Deviation
- Python – Mean deviation of Elements
Advertisements