Smoothing edges of line plot

97 Views Asked by At

So I've tried a whole bunch of spline tools and curve fittings but they all completely change the looks of my plot. I simply want some smmother edges and not sharp corners in the plot.

Here's the code:

import numpy as np
from matplotlib import pyplot as plt

constant = 1.4

xdata = [52.8905, 52.7612, 51.7277, 51.6320, 47.8479]
data1 = [1.4826, 1.5395, 1.5863, 1.5898, 1.5343]
data2 = [1.1551, 1.1570, 1.1690, 1.1700, 1.1707]
ydata = np.zeros(5)

def myfunc(D1, D2, D3):
    polyeff = (np.log(D1) * (D3 - 1)) / (D3 * np.log(D2))
    return polyeff

for i, value in enumerate(xdata):
    ydata[i] = myfunc(data1[i], data2[i], constant)


plt.plot(xdata, ydata)
plt.show()

And this is the plot that I want to have smmoth edges on:

enter image description here

I've tried most of the methods in this: Smoothing out a curve but it always ends up looking like somwthing completly different. How can I fix this?

1

There are 1 best solutions below

1
Ironstacker727 On

'Scatter with smooth lines and markers'

This is the chart type I used in excel, it seems to be specifically made to be used when you have few data points, bingo!

Called 'Scatter with smooth lines and markers'