加载数据集
import seaborn as snsimport pandas as pdimport matplotlib.pyplot as pltiris = pd.read_csv('iris.csv')iris.head()
python 绘制散点图矩阵:
展示两两特征之间的关系
sns.set(style='ticks')sns.pairplot(iris,vars=['sepal_length','petal_length','sepal_width','petal_width'])
python绘制平行坐标图
data = np.array(iris[['sepal_length','petal_length','sepal_width','petal_width']]).tolist()parallel_axis = [{"dim":0,"name":"萼片长度"},{"dim":1,"name":"萼片宽度"},{"dim":2,"name":"花瓣长度"},{"dim":3,"name":"花瓣宽度"}]parallel = Parallel(init_opts=opts.InitOpts(width="800px",height="600px"))parallel.add_schema(schema=parallel_axis)parallel.add('iris平行图',data=data,linestyle_opts=opts.LineStyleOpts(width=2,opacity=0.2))parallel.render_notebook()