#!/usr/bin/env python
# encoding: utf-8
import numpy as np
import matplotlib.pyplot as plt
def test_plot():
x = np.arange(0, 5, 0.1);
print type(x),x
y = np.sin(x)
plt.plot(x, y)
plt.show()
def test_plot_simple():
#根据点划线:两点间用线连接
print ''
'''
plot
return :
(lags, c, line, b) : where:
lags are a length 2`maxlags+1 lag vector.
c is the 2`maxlags+1 auto correlation vectorI
line is a Line2D instance returned by plot.
b is the x-axis.
'''
x=[1,4,2,3]
y=[2,4,6,8]
print x
print y
#plt.plot(x, y)
plt.plot(x)
plt.show()
def test_dataset_ml_draw():
print '画数据集,及分类结果'
from sklearn import datasets
from sklearn.model_selection import cross_val_predict
from sklearn import linear_model
import matplotlib.pyplot as plt
lr = linear_model.LinearRegression()
boston = datasets.load_boston()
y = boston.target
# cross_val_pr
绘图 matplotlib使用
最新推荐文章于 2022-05-14 20:46:52 发布
该博客介绍了如何使用matplotlib进行图形绘制,包括正弦曲线的绘制和简单的点划线图表。同时,展示了如何结合sklearn库,利用线性回归模型对波士顿房价数据集进行交叉验证预测,并将测量值与预测值进行可视化展示。
摘要由CSDN通过智能技术生成