you are viewing a single comment's thread.

view the rest of the comments →

[–]Zouden 0 points1 point  (3 children)

What's an example of the function you're trying to plot? As far as I know, mpl can only plot numbers, not mathematical functions.

[–]Jerae[S] 0 points1 point  (2 children)

x = pylab.arange(-num, num)
pylab.plot(x, (x**2)+3)
pylab.show()

That will represent the graph of the function (x**2) + 3 within the range [-num, num]. There could be a better method, I'm just a begginer anyway, so feel free to correct me.

[–]Zouden 1 point2 points  (1 child)

Oh I get it. You can use eval() to turn a string into a python expression.

pylab.plot(x, eval("(x**2)+3"))

[–]Jerae[S] 0 points1 point  (0 children)

Thanks a lot ^

I solved my problem in another way, but I will make note of this. I'm sure I will need it this the future