how to form smooth curve in matplotlib

Solutions on MaxInterview for how to form smooth curve in matplotlib by the best coders in the world

showing results for - "how to form smooth curve in matplotlib"
Rafael
16 Jun 2018
1from scipy.interpolate import make_interp_spline, BSpline
2
3#create data
4x = np.array([1, 2, 3, 4, 5, 6, 7, 8])
5y = np.array([4, 9, 12, 30, 45, 88, 140, 230])
6
7#define x as 200 equally spaced values between the min and max of original x 
8xnew = np.linspace(x.min(), x.max(), 200) 
9
10#define spline
11spl = make_interp_spline(x, y, k=3)
12y_smooth = spl(xnew)
13
14#create smooth line chart 
15plt.plot(xnew, y_smooth)
16plt.show()
17
queries leading to this page
smooth curve in matplotlibsmooth line pythonpython smooth plothow to make a smooth curve in python with matplotlib with scipysmooth line python scipymake a smooth curve form points i n pyplotmatplotlib draw smooth linehow to make smooth graph in matplotlibhow to plot smoothed data in pythonhow to make a graph smooth matplotlibplt plot smoothmatplotlib smooth curvehow to get plot smooth in pythonmake smooth python line plothow to get a smooth plot in pythonsmooth curves pltpython plot smooth curvematplotlib how to plot smoothhow to smooth graph in matplotlibpython plot data with splines for smooth curve how to plot smooth curve in pythonsmooth line in matplotlibhow to form smooth curve in matplotlibhow to draw a smooth curve in pyplotsmooth curve matplotlibmatplotlib plot smoothmatplotlib smooth graphsmooth out curve matplotlibplot smooth oythonhow to smooth a graph in pythonmake a smooth curve from points i n pyplotsmooth a plot matplotlib pythonmake plot line smooth pythonplotting a smooth curve in pythonsmoothening subplots pythoncreating smooth fitted plots from data pythonhow to make a smooth curve in matplotlibmatplotlib smooth line only y axis matplotlib smooth out line graphhow to get smooth curve in python plotmatplotlib draw curve trhough pointssuavize plot matplotlibplt plot smoothinghow to smooth plot in python matplotlibmatplotlib smooth plothow to get a smooth curve in matplotlibmatplotlib curved graph how to plot a smooth curve in pythonhow to draw smooth curves in matplotlibsmooth plot matplotlibhow to smooth a plot in matplotlibsmooth plot in matplotlibsmooth line matplotlibdraw a smooth curve between points pythonhow to make a smooth curve in pyplotsmooth curve pythonsmoothing matplotlibplot smooth curve matplotlibhow to smoothen a graph in pythonpython matplotlib smooth curvesmooth plot pythonhow to make a smooth curve in python with matplotlibsmooth matplotlib plotshow to smooth a matplotlib graph in pythonhow to get a smooth matplotlib animatplotlib smooth linepython smooth out curvehow to smooth out a curve matplot libcurved line matplotlibhow to draw smooth curve in matplot libsmooth matplotlib linehow to smooth a matplotlib plothow to smooth matplot lib line graphshow to form smooth curve in matplotlib