Reputation: 2501
In ipython-qtconsole
, I can easily create a simple plot:
ipython qtconsole --pylab=inline
x = linspace(0, 2*pi, 1000)
plot(x, sin(x))
Is there a way to specify multiple functions to be drawn inside the same plot ? I have tried the following, but neither works:
plot(x, sin(x), cos(x))
plot(x, [sin(x), cos(x)])
plot(x, {sin(x), cos(x)})
Upvotes: 0
Views: 333
Reputation: 64443
You can define a figure and axes, draw all the plots and then display the figure. Creating them will also display the empty figure once, i dont know if that can be supressed.
So:
x = linspace(0, 2*pi, 1000)
fig, ax = plt.subplots()
ax.plot(x, sin(x))
ax.plot(x, cos(x))
display(fig)
That would show all functions in the same axes.
Upvotes: 1
Reputation: 527
You can write multiple plot
commands on the same line, separated with a comma:
x = linspace(0, 2*pi, 1000)
plot(x, sin(x)), plot(x, cos(x))
Upvotes: 0