Skip to content
Advertisement

Plotting multiple functions with pyplot, passing functions into functions, & reusing code

JavaScript

I want to plot multiple arbitrary math functions while reusing code for getting coordinates and plotting them.

Advertisement

Answer

You have to provide the function itself and not the call to it.

JavaScript

You could restructure to something like this. Having a dedicated function to produce the coordinates and a dedicated function to draw them:

JavaScript
Advertisement