Matplotlib 3.0 Cookbook
上QQ阅读APP看书,第一时间看更新

There's more...

You can add one more line graph to the same plot and go on until you complete your interactive session:

  1. Plot a line graph:
plt.plot([1.5, 3.0])
  1. Add labels and title:
plt.title("Interactive Plot")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
  1. Add one more line graph:
plt.plot([3.5, 2.5])

The following graph is the output obtained after executing the code:

Hence, we have now worked in interactive mode.