How to plot curves with matplotlib | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How to plot curves with matplotlib

I am trying to plot the Sigmoid Function, is that possible?

28th Jul 2018, 5:41 AM
Edwin Pratt
Edwin Pratt - avatar
2 Answers
+ 1
You can use numpy and matplotlib for that. For this example: import numpy as np import matplotlib.plot as plt def sigmoid(x): return 1./(1+np.exp(-x)) x = np.linspace(-5,5,50) #prints 50 points from -5 to 5 in equal distance y = sigmoid(x) plt.plot(x,y) plt.show() for more Information consult the documentation of numpy and matplotplib (google)
28th Jul 2018, 10:53 AM
Matthias
Matthias - avatar
+ 2
Thanks Matthias !
11th Oct 2018, 12:05 PM
Edwin Pratt
Edwin Pratt - avatar