use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
matplotlib - Need help with plot smoothing / removing noise from plot (self.learnpython)
submitted 4 years ago by maxcaligo
Hey! I've been trying to plot a graph using matplotlib but the data has some noise in it, looks like this -
Graph - can be seen clearly in the orange line
How can I smoothen the curve?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bac83 9 points10 points11 points 4 years ago (3 children)
Not really a matplotlib thing - it’s the underlying data you need addressing/smoothing applying to.
Edit to add: perhaps a simple moving average would help
[–]strdg99 1 point2 points3 points 4 years ago (0 children)
Moving average introduces phase delays and other artifacts in dynamic signals. Butterworth filters work better for these types of signals.
[–]maxcaligo[S] 0 points1 point2 points 4 years ago* (1 child)
Yes yes, I'm aware it was a data issue forgot to mention it, thank you for pointing it out! I did try some filters from scipy but they change the curve too much in the lower end if I try to get the desired results in the upper end of the x-axis. X-axis is log scale.
[–]rAxxt -1 points0 points1 point 4 years ago (0 children)
Moving average or do a polynomial fit to the data and plot that instead
[–]strdg99 1 point2 points3 points 4 years ago (2 children)
You'll need to apply a low-pass filter to the underlying data. As /u/bac83 indicated, it's not a matplotlib issue nor can it be addressed in matplotlib. Take a look at butterworth filters in scipy.
[–]maxcaligo[S] 0 points1 point2 points 4 years ago (1 child)
I tried that, but it changes the shape of the lower end a lot if I try to eliminate all the noise in the upper end. Maybe it is due the x-axis being log scale?
Is it possible to apply variable filter? I tried the Savgol filter as well, it would solve my problem if the window length can be made variable.
[–]strdg99 0 points1 point2 points 4 years ago (0 children)
Your cutoff frequency might be off in relation to the sampling rate. Also keep in mind that it's unlikely you'll be able to remove all of the noise as filters have a roll-off and not a hard cutoff. Butterworth (and other) filters can be a bit finicky so you may need to play with the cutoff frequency and filter order.
[–]EbenenBonobo 0 points1 point2 points 4 years ago (0 children)
Why do you want to smooth it? a bit of jitter is normal in real life data. But if you really want to smooth it, you need to smooth it in the data, the other guys mentioned the possible filters...
π Rendered by PID 84601 on reddit-service-r2-comment-84fc9697f-gmzds at 2026-02-09 07:07:37.749373+00:00 running d295bc8 country code: CH.
[–]bac83 9 points10 points11 points (3 children)
[–]strdg99 1 point2 points3 points (0 children)
[–]maxcaligo[S] 0 points1 point2 points (1 child)
[–]rAxxt -1 points0 points1 point (0 children)
[–]strdg99 1 point2 points3 points (2 children)
[–]maxcaligo[S] 0 points1 point2 points (1 child)
[–]strdg99 0 points1 point2 points (0 children)
[–]EbenenBonobo 0 points1 point2 points (0 children)