Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Smooth curve in matplotlib
#1
Hello,
suppose I have the following dataset as represented in the code.
This dataset is coming from measurements which are sometimes inconsistent and there are some "peaks" in the curve.
Is there any way to smoothe the curve?

import matplotlib as mpl

from matplotlib import pyplot as plt

y = [ 0.008000000000000002, 0.007600000000000001,  0.010200000000000002,  0.010100000000000001,  0.0097,  0.010299999999999998,  0.0113]
x = [10, 20, 40, 80, 160, 320, 640]

plt.rc('font', family='serif', size='10')

fig, ax1 = plt.subplots()
ax1.plot(x,y,linewidth=1)

ax1.set_xscale('log')
ax1.set_yscale('log')
plt.show()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Learning curve astral_travel 3 484 Apr-05-2024, 06:58 PM
Last Post: jefsummers
  How can I design shapes on a curve in python? mervea 2 852 Sep-14-2023, 01:04 PM
Last Post: Pedroski55
  Fitting data to a curve daaegp 1 647 Jun-30-2023, 08:06 PM
Last Post: Gribouillis
  matplotlib Plotting smooth line with nans mikisDeWitte 4 3,186 Mar-11-2022, 02:40 PM
Last Post: mikisDeWitte
  Find factor to match test curve to golden curve SriRajesh 0 1,580 Jun-17-2021, 04:39 AM
Last Post: SriRajesh
  Fitting Gaussian curve to data file Laplace12 0 2,794 Jun-09-2021, 10:45 AM
Last Post: Laplace12
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,279 Mar-11-2021, 10:52 AM
Last Post: buran
  search of a curve fitting function bluffy5 2 2,463 Dec-13-2020, 09:53 AM
Last Post: ndc85430
  Import Text, output curve geometry Alyner 0 2,013 Feb-03-2020, 03:05 AM
Last Post: Alyner
  Finding values to draw a line on a curve kesenthilkumar 2 3,565 Sep-19-2017, 09:50 AM
Last Post: kesenthilkumar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020