This is inspired by http://matt.might.net/articles/rendering-mathematical-functions-in-javascript-with-canvas-html/ I refactored the code for readability. Demo: https://melvinroest.github.io/Sigmoid-Playground/