这里利用Nathan Yau所著的<鲜活的数据:数据可视化指南>一书中的数据,学习画图. 数据地址:http://book.flowingdata.com/ch05/data/us-population-by-age.xls 准备工作:先导入matplotlib和pandas,用pandas读取excel文件,然后创建一个图像和一个坐标轴 import pandas as pd from matplotlib import pyplot as plt population=pd.read_ex
import matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dimport numpy as np #bbb=[1 if (i <=0.5 or i >=1.5) else 0 for i in D def fun(x, y): value= x**2+y**2 return value fig1 = plt.figure()ax = Axes3D(fig1)X, Y = np.mgrid[-4:4:40j, -4:
这里利用Jake Vanderplas所著的<Python数据科学手册>一书中的数据,学习画图. 数据地址:https://raw.githubusercontent.com/jakevdp/data-CDCbirths/master/births.csv 准备工作:先导入matplotlib和pandas,用pandas读取csv文件,然后创建一个图像和一个坐标轴 import pandas as pd from matplotlib import pyplot as plt birth=p
沉淀再出发:用python画各种图表 一.前言 最近需要用python来做一些统计和画图,因此做一些笔记. 二.python画各种图表 2.1.使用turtle来画图 import turtle as t #turtle库是python的内部库,直接import使用即可 import time def draw_diamond(turt): for i in range(1,3): turt.forward(100) #向前走100步 turt.right(45) #海龟头向右转45度 turt