Jabb
Jabb

Reputation: 3502

How to smooth from data and plot it with Python

I have a sequence of data points with a significant peak at 1 point

1
18
120
196
476
10716
42
43
96
27
61
50
31
15
9
6
11

When I plot the data using the webplotlib python package, the 10716 peak distorts the resulting plot in a way so that the smaller values appear almost as a "flat" line. I am describing the problem with my own words since I don't have enough background knowledge about statistics. What is the best way / algorithm to smooth the peak a bit, so the other data becomes "more visible"? I already tried gaussian smoothing (link), but it appears to not be an appropriate techniqe.

enter image description here

Upvotes: 0

Views: 288

Answers (1)

unutbu
unutbu

Reputation: 879251

Using GWW's idea, you could use plt.semilogy:

import numpy as np
import matplotlib.pyplot as plt
x = np.loadtxt('data')
plt.semilogy(x)
plt.show()

enter image description here

Upvotes: 1

Related Questions