从文件中加载数据有两种方法,一种是利用内置的csv模块,一种是利用第三方模块numpy import matplotlib.pyplot as plt import csv import numpy as np # csv 方法 x = [] y = [] with open('example.tx...
分类:
其他好文 时间:
2015-11-05 06:11:59
阅读次数:
190
import matplotlib.pyplot as plt slices = [7,2,2,13] activities = ['sleeping','eating','working','playing'] colors = ['c','m','r','g'] plt.pie( slices,...
分类:
其他好文 时间:
2015-11-05 06:05:36
阅读次数:
131
import matplotlib.pyplot as plt days = [1,2,3,4,5] sleeping = [7,8,6,11,7] eating = [3,3,4,2,3] working = [7,8,7,3,2] playing = [7,5,7,8,12] #stack ch...
分类:
其他好文 时间:
2015-11-05 00:44:58
阅读次数:
337
在给画出的直线加上图例和标签可以参照下面的代码import matplotlib.pyplot as pltx1 = [1,2,3]y1 = [5,7,4]x2 = [1,2,3]y2 = [10,14,12]plt.plot(x1,y1,label='line1')plt.plot(x2,y2,l...
分类:
其他好文 时间:
2015-11-04 14:41:48
阅读次数:
181
要使用matplotlib画直线可以使用下面的方法import matplot.pyplot as pltplt.plot([1,2,3],[5,7,4]) #plt.plot([x1,x2,x3],[y1,y2,y3])plt.show()(x1, y1,), (x2,y2) 决定了另外一条直线(...
分类:
其他好文 时间:
2015-11-04 14:37:54
阅读次数:
191
读取部分结果程序# -*- coding: utf-8 -*-import numpy as np import matplotlib.pyplot as pltfrom PIL import Imagedef ImagetoData(num=100): filename = 'face/fa...
分类:
编程语言 时间:
2015-11-01 11:19:24
阅读次数:
521
程序# coding=gbkfrom PIL import Imageimport numpy as np# import scipyimport matplotlib.pyplot as pltdef ImageToMatrix(filename): # 读取图片 im = Image...
分类:
编程语言 时间:
2015-11-01 11:19:16
阅读次数:
254
首先观看数据:l 数据的基本特征用 describe 描述每个基本特征l 画图画出每个特征的基本统计图应用import matplotlib.pylab as pl 画图显示l 关于特征值特别大的数据集 ;可能对结果产生权重的等级影响 所以尽量将数据进行归一化 特征值归一化的原因:1;看数据范围看看...
分类:
编程语言 时间:
2015-10-23 16:22:35
阅读次数:
254
首先安装matplotlib,使用pip install matplotlib。安装完成后在python的命令行敲入import matplotlib,如果没问题,说明安装成功可以开始画图了。看好了,见证奇迹的时刻from matplotlib import pyplot as pltplt.plo...
分类:
其他好文 时间:
2015-10-20 19:15:50
阅读次数:
247
下面这个方法不能用。网上很多教程都是说在配置文件中修改:%Python_home%Lib\site-packages\matplotlib\mpl-data\matplotlibrc (Windows) font.family : sans-serif #打开该选项 font.sans-se...
分类:
其他好文 时间:
2015-10-14 12:09:25
阅读次数:
205