透過 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