通过 Python Matplotlib 对交互式绘图进行命令行操作
要获取交互式绘图,我们需要激活图形。使用 plt.ioff() 和 plt.ion(),我们可以使用绘图执行交互式操作。
打开 Ipython shell,并在 shell 中输入以下命令。
示例
In [1]: %matplotlib auto
Using matplotlib backend: GTK3Agg
In [2]: import matplotlib.pyplot as
In [3]: fig, ax = plt.subplots() # Diagram will pop up. Let’s interact.
In [4]: ln, = ax.plot(range(5)) # Drawing a line
In [5]: ln.set_color("orange") # Changing drawn line to orange
In [6]: plt.ioff() # Stopped interaction
In [7]: ln.set_color("red")
# Since we have stopped the interaction in the last step
In [8]: plt.ion() # Started interaction输出

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP