Last active
March 1, 2021 01:45
-
-
Save GUOSHU-COOL/0b841c41d84e7c4c26acba509b99539c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| #构造一组随机数据 | |
| s = pd.DataFrame(np.random.randn(1000)+10,columns = ['value']) | |
| #画散点图和直方图 | |
| fig = plt.figure(figsize = (10,6)) | |
| ax1 = fig.add_subplot(2,1,1) # 创建子图1 | |
| ax1.scatter(s.index, s.values) | |
| plt.grid() | |
| ax2 = fig.add_subplot(2,1,2) # 创建子图2 | |
| s.hist(bins=30,alpha = 0.5,ax = ax2) | |
| s.plot(kind = 'kde', secondary_y=True,ax = ax2) | |
| plt.grid() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment