Introduced
AS NP numpy Import
Import PANDAS AS PD
Import matplotlib.pyplot AS PLT
# Import correlation module
use | # → plt.show chart window. 1 () plt.plot (np.random.rand (10)) plt.show () # directly generate charts |
Features: The use without written show () | Chart Window # 2 → magic function, an embedded chart % matplotlib inline X = np.random.randn (1000) Y = np.random.randn (1000) plt.scatter (X, Y) # chart directly embedded without plt.show () # <matplotlib.collections.PathCollection AT ...> representing the chart object |
Chart # 3 → magic window function, interactive pop-up window matplotlib % matplotlib Notebook S = pd.Series (np.random.randn (100)) s.plot (style = 'K - O', figsize = (10, 5)) # interactive matplotlib window, without plt.show () # can do some adjustment |
|
Chart # 4 → magic window functions, console pop matplotlib % matplotlib QT5 DF = pd.DataFrame (np.random.rand (50,2), Columns = [ 'A', 'B']) df.hist (= figsize (12,5), Color = 'G', Alpha = 0.8) # interactivity console # have been set, the display mode (such as notebook), and then need to restart the operation function magic # page embedded interactive windows and controls Taiwan, can only display a # plt.close () # Close # plt.gcf (). the Clear () # empty the contents of each chart within |
Types: