摘要: 1 import numpy as np 2 import pandas as pd 3 import matplotlib.pyplot as plt 4 import seaborn as sns 5 6 %matplotlib notebook 1 np.random.seed(1234) 2 3 v1 = pd.Series(np.random.normal(0,10,1000)... 阅读全文
posted @ 2018-03-09 21:32 郑哲 阅读(332) 评论(0) 推荐(0) 编辑
摘要: DataFrame.plot 我们可以设置plot函数中的kind来决定我们想画什么 下面列举kind的的可选值 kind : 'line' : 直线(默认) 'bar' : 垂直条形图 'barh' : 水平条形图 'hist' : 直方图 'box' : 箱型图 'kde' : 核密度估计图 ' 阅读全文
posted @ 2018-03-09 21:18 郑哲 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 1 plt.figure() 2 data = np.random.rand(10) 3 plt.plot(data) 4 #创建点击事件 5 def onclick(event): 6 plt.cla() 7 plt.plot(data) 8 plt.gca().set_title('Event at pixels {},{} \nand data {}... 阅读全文
posted @ 2018-03-09 20:50 郑哲 阅读(1085) 评论(0) 推荐(0) 编辑
摘要: 1 import matplotlib.animation as animation 2 3 n = 100 4 x = np.random.randn(n) 1 # create the function that will do the plotting, where curr is the current frame 2 def update(curr): 3 # ch... 阅读全文
posted @ 2018-03-09 20:44 郑哲 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 1 plt.figure() 2 3 Y = np.random.normal(loc=0.0, scale=1.0, size=10000) 4 X = np.random.random(size=10000) #bins设置区间大小 5 _ = plt.hist2d(X, Y, bins=25) 1 plt.figure() 2 _ = plt.hist2d(X, Y, bins=1... 阅读全文
posted @ 2018-03-09 20:40 郑哲 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 1 import pandas as pd 2 normal_sample = np.random.normal(loc=0.0, scale=1.0, size=10000) 3 random_sample = np.random.random(size=10000) 4 gamma_sample = np.random.gamma(2, size=10000) 5 6 #创建新... 阅读全文
posted @ 2018-03-09 20:34 郑哲 阅读(385) 评论(0) 推荐(0) 编辑
摘要: 在图像上直方图和条形图相似,但是直方图是用来统计数据在某个值上的数量。 阅读全文
posted @ 2018-03-09 20:10 郑哲 阅读(356) 评论(0) 推荐(0) 编辑
摘要: True 阅读全文
posted @ 2018-03-09 19:53 郑哲 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 用线性数据画柱状图 1 plt.figure() 2 xvals = range(len(linear_data)) 3 plt.bar(xvals, linear_data, width = 0.3) 4 5 new_xvals = [] 6 7 # 创建new_xvals使横坐标向右移动0.3,用平方数据画红色的柱状图 8 for item in xvals: 9 ... 阅读全文
posted @ 2018-03-09 19:41 郑哲 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 错误代码 阅读全文
posted @ 2018-03-09 19:22 郑哲 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 1 import numpy as np 2 3 x = np.array([1,2,3,4,5,6,7,8]) 4 y = x 5 6 plt.figure() 7 plt.scatter(x, y) # similar to plt.plot(x, y, '.'), but the underlying child objects in the axes are not Line2D ... 阅读全文
posted @ 2018-03-09 18:47 郑哲 阅读(649) 评论(0) 推荐(0) 编辑