Iris植物分类数据可视化(散点图)(python-nvd3)

from nvd3 import scatterChart
import pandas as pd
#scikit-learn 库内置著名的Iris植物分类数据集
from sklearn.datasets import load_iris
# 源数据data读取
dataset = load_iris()
data = pd.DataFrame(dataset.data,columns = ('sepalLength','sepalWidth','petalLength','petalWidth'))
data['species'] = dataset.target
type = "Iris Morphology"
# 创建画布
chart = scatterChart(name=type, height=600, width=1024, x_is_date=False)
# 设置标题
chart.set_containerheader("    " + type + "   ")
# 数据分类
xdata1 = list(data[data['species']==0]['sepalLength'])
ydata1 = list(data[data['species']==0]['sepalWidth'])
xdata2 = list(data[data['species']==0]['petalLength'])
ydata2 = list(data[data['species']==0]['petalWidth'])
xdata3 = list(data[data['species']==1]['sepalLength'])
ydata3 = list(data[data['species']==1]['sepalWidth'])
xdata4 = list(data[data['species']==1]['petalLength'])
ydata4 = list(data[data['species']==1]['petalWidth'])
xdata5 = list(data[data['species']==2]['sepalLength'])
ydata5 = list(data[data['species']==2]['sepalWidth'])
xdata6 = list(data[data['species']==2]['petalLength'])
ydata6 = list(data[data['species']==2]['petalWidth'])
# 设置图例属性,还有一个color属性,不过不建议设,没有默认好看。
kwargs1 = {'shape': 'circle', 'size': '1'}
kwargs2 = {'shape': 'cross', 'size': '10'}
kwargs3 = {'shape': 'triangle-up', 'size': '15'}
kwargs4 = {'shape': 'triangle-down', 'size': '30'}
kwargs5 = {'shape': 'diamond', 'size': '10'}
kwargs6 = {'shape': 'square', 'size': '20'}
# 设置指向插件显示内容,散点图不显示
extra_serie = {"tooltip": {"y_start": "", "y_end": " calls"}}
chart.add_serie(name="sepal 0", y=ydata1, x=xdata1, extra=extra_serie, **kwargs1)
chart.add_serie(name="petal 0", y=ydata2, x=xdata2, extra=extra_serie, **kwargs2)
chart.add_serie(name="sepal 1", y=ydata3, x=xdata3, extra=extra_serie, **kwargs3)
chart.add_serie(name="petal 1", y=ydata4, x=xdata4, extra=extra_serie, **kwargs4)
chart.add_serie(name="sepal 2", y=ydata5, x=xdata5, extra=extra_serie, **kwargs5)
chart.add_serie(name="petal 2", y=ydata6, x=xdata6, extra=extra_serie, **kwargs6)
# 生成html源码
chart.buildhtml()
# 保存本地
output_file = open('Iris_Morphology.html', 'w')
output_file.write(chart.htmlcontent)
output_file.close()

在这里插入图片描述

html源码

lang="en">
charset="utf-8" />
href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.7.0/nv.d3.min.css" rel="stylesheet" />
Iris Morphology
id="iris_morphology">style="width:1024px;height:600px;">
data_iris_morphology=[{"values": [{"x": 5.1, "y": 3.5, "shape": "circle", "size": "1"}, {"x": 4.9, "y": 3.0, "shape": "circle", "size": "1"}, {"x": 4.7, "y": 3.2, "shape": "circle", "size": "1"}, {"x": 4.6, "y": 3.1, "shape": "circle", "size": "1"}, {"x": 5.0, "y": 3.6, "shape": "circle", "size": "1"}, {"x": 5.4, "y": 3.9, "shape": "circle", "size": "1"}, {"x": 4.6, "y": 3.4, "shape": "circle", "size": "1"}, {"x": 5.0, "y": 3.4, "shape": "circle", "size": "1"}, {"x": 4.4, "y": 2.9, "shape": "circle", "size": "1"}, {"x": 4.9, "y": 3.1, "shape": "circle", "size": "1"}, {"x": 5.4, "y": 3.7, "shape": "circle", "size": "1"}, {"x": 4.8, "y": 3.4, "shape": "circle", "size": "1"}, {"x": 4.8, "y": 3.0, "shape": "circle", "size": "1"}, {"x": 4.3, "y": 3.0, "shape": "circle", "size": "1"}, {"x": 5.8, "y": 4.0, "shape": "circle", "size": "1"}, {"x": 5.7, "y": 4.4, "shape": "circle", "size": "1"}, {"x": 5.4, "y": 3.9, "shape": "circle", "size": "1"}, {"x": 5.1, "y": 3.5, "shape": "circle", "size": "1"}, {"x": 5.7, "y": 3.8, "shape": "circle", "size": "1"}, {"x": 5.1, "y": 3.8, "shape": "circle", "size": "1"}, {"x": 5.4, "y": 3.4, "shape": "circle", "size": "1"}, {"x": 5.1, "y": 3.7, "shape": "circle", "size": "1"}, {"x": 4.6, "y": 3.6, "shape": "circle", "size": "1"}, {"x": 5.1, "y": 3.3, "shape": "circle", "size": "1"}, {"x": 4.8, "y": 3.4, "shape": "circle", "size": "1"}, {"x": 5.0, "y": 3.0, "shape": "circle", "size": "1"}, {"x": 5.0, "y": 3.4, "shape": "circle", "size": "1"}, {"x": 5.2, "y": 3.5, "shape": "circle", "size": "1"}, {"x": 5.2, "y": 3.4, "shape": "circle", "size": "1"}, {"x": 4.7, "y": 3.2, "shape": "circle", "size": "1"}, {"x": 4.8, "y": 3.1, "shape": "circle", "size": "1"}, {"x": 5.4, "y": 3.4, "shape": "circle", "size": "1"}, {"x": 5.2, "y": 4.1, "shape": "circle", "size": "1"}, {"x": 5.5, "y": 4.2, "shape": "circle", "size": "1"}, {"x": 4.9, "y": 3.1, "shape": "circle", "size": "1"}, {"x": 5.0, "y": 3.2, "shape": "circle", "size": "1"}, {"x": 5.5, "y": 3.5, "shape": "circle", "size": "1"}, {"x": 4.9, "y": 3.1, "shape": "circle", "size": "1"}, {"x": 4.4, "y": 3.0, "shape": "circle", "size": "1"}, {"x": 5.1, "y": 3.4, "shape": "circle", "size": "1"}, {"x": 5.0, "y": 3.5, "shape": "circle", "size": "1"}, {"x": 4.5, "y": 2.3, "shape": "circle", "size": "1"}, {"x": 4.4, "y": 3.2, "shape": "circle", "size": "1"}, {"x": 5.0, "y": 3.5, "shape": "circle", "size": "1"}, {"x": 5.1, "y": 3.8, "shape": "circle", "size": "1"}, {"x": 4.8, "y": 3.0, "shape": "circle", "size": "1"}, {"x": 5.1, "y": 3.8, "shape": "circle", "size": "1"}, {"x": 4.6, "y": 3.2, "shape": "circle", "size": "1"}, {"x": 5.3, "y": 3.7, "shape": "circle", "size": "1"}, {"x": 5.0, "y": 3.3, "shape": "circle", "size": "1"}], "key": "sepal 0", "yAxis": "1"}, {"values": [{"x": 1.4, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.3, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.7, "y": 0.4, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.3, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.1, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.6, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.1, "shape": "cross", "size": "10"}, {"x": 1.1, "y": 0.1, "shape": "cross", "size": "10"}, {"x": 1.2, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.4, "shape": "cross", "size": "10"}, {"x": 1.3, "y": 0.4, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.3, "shape": "cross", "size": "10"}, {"x": 1.7, "y": 0.3, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.3, "shape": "cross", "size": "10"}, {"x": 1.7, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.4, "shape": "cross", "size": "10"}, {"x": 1.0, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.7, "y": 0.5, "shape": "cross", "size": "10"}, {"x": 1.9, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.6, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.6, "y": 0.4, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.6, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.6, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.4, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.1, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.1, "shape": "cross", "size": "10"}, {"x": 1.2, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.3, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.1, "shape": "cross", "size": "10"}, {"x": 1.3, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.3, "y": 0.3, "shape": "cross", "size": "10"}, {"x": 1.3, "y": 0.3, "shape": "cross", "size": "10"}, {"x": 1.3, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.6, "y": 0.6, "shape": "cross", "size": "10"}, {"x": 1.9, "y": 0.4, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.3, "shape": "cross", "size": "10"}, {"x": 1.6, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.5, "y": 0.2, "shape": "cross", "size": "10"}, {"x": 1.4, "y": 0.2, "shape": "cross", "size": "10"}], "key": "petal 0", "yAxis": "1"}, {"values": [{"x": 7.0, "y": 3.2, "shape": "triangle-up", "size": "15"}, {"x": 6.4, "y": 3.2, "shape": "triangle-up", "size": "15"}, {"x": 6.9, "y": 3.1, "shape": "triangle-up", "size": "15"}, {"x": 5.5, "y": 2.3, "shape": "triangle-up", "size": "15"}, {"x": 6.5, "y": 2.8, "shape": "triangle-up", "size": "15"}, {"x": 5.7, "y": 2.8, "shape": "triangle-up", "size": "15"}, {"x": 6.3, "y": 3.3, "shape": "triangle-up", "size": "15"}, {"x": 4.9, "y": 2.4, "shape": "triangle-up", "size": "15"}, {"x": 6.6, "y": 2.9, "shape": "triangle-up", "size": "15"}, {"x": 5.2, "y": 2.7, "shape": "triangle-up", "size": "15"}, {"x": 5.0, "y": 2.0, "shape": "triangle-up", "size": "15"}, {"x": 5.9, "y": 3.0, "shape": "triangle-up", "size": "15"}, {"x": 6.0, "y": 2.2, "shape": "triangle-up", "size": "15"}, {"x": 6.1, "y": 2.9, "shape": "triangle-up", "size": "15"}, {"x": 5.6, "y": 2.9, "shape": "triangle-up", "size": "15"}, {"x": 6.7, "y": 3.1, "shape": "triangle-up", "size": "15"}, {"x": 5.6, "y": 3.0, "shape": "triangle-up", "size": "15"}, {"x": 5.8, "y": 2.7, "shape": "triangle-up", "size": "15"}, {"x": 6.2, "y": 2.2, "shape": "triangle-up", "size": "15"}, {"x": 5.6, "y": 2.5, "shape": "triangle-up", "size": "15"}, {"x": 5.9, "y": 3.2, "shape": "triangle-up", "size": "15"}, {"x": 6.1, "y": 2.8, "shape": "triangle-up", "size": "15"}, {"x": 6.3, "y": 2.5, "shape": "triangle-up", "size": "15"}, {"x": 6.1, "y": 2.8, "shape": "triangle-up", "size": "15"}, {"x": 6.4, "y": 2.9, "shape": "triangle-up", "size": "15"}, {"x": 6.6, "y": 3.0, "shape": "triangle-up", "size": "15"}, {"x": 6.8, "y": 2.8, "shape": "triangle-up", "size": "15"}, {"x": 6.7, "y": 3.0, "shape": "triangle-up", "size": "15"}, {"x": 6.0, "y": 2.9, "shape": "triangle-up", "size": "15"}, {"x": 5.7, "y": 2.6, "shape": "triangle-up", "size": "15"}, {"x": 5.5, "y": 2.4, "shape": "triangle-up", "size": "15"}, {"x": 5.5, "y": 2.4, "shape": "triangle-up", "size": "15"}, {"x": 5.8, "y": 2.7, "shape": "triangle-up", "size": "15"}, {"x": 6.0, "y": 2.7, "shape": "triangle-up", "size": "15"}, {"x": 5.4, "y": 3.0, "shape": "triangle-up", "size": "15"}, {"x": 6.0, "y": 3.4, "shape": "triangle-up", "size": "15"}, {"x": 6.7, "y": 3.1, "shape": "triangle-up", "size": "15"}, {"x": 6.3, "y": 2.3, "shape": "triangle-up", "size": "15"}, {"x": 5.6, "y": 3.0, "shape": "triangle-up", "size": "15"}, {"x": 5.5, "y": 2.5, "shape": "triangle-up", "size": "15"}, {"x": 5.5, "y": 2.6, "shape": "triangle-up", "size": "15"}, {"x": 6.1, "y": 3.0, "shape": "triangle-up", "size": "15"}, {"x": 5.8, "y": 2.6, "shape": "triangle-up", "size": "15"}, {"x": 5.0, "y": 2.3, "shape": "triangle-up", "size": "15"}, {"x": 5.6, "y": 2.7, "shape": "triangle-up", "size": "15"}, {"x": 5.7, "y": 3.0, "shape": "triangle-up", "size": "15"}, {"x": 5.7, "y": 2.9, "shape": "triangle-up", "size": "15"}, {"x": 6.2, "y": 2.9, "shape": "triangle-up", "size": "15"}, {"x": 5.1, "y": 2.5, "shape": "triangle-up", "size": "15"}, {"x": 5.7, "y": 2.8, "shape": "triangle-up", "size": "15"}], "key": "sepal 1", "yAxis": "1"}, {"values": [{"x": 4.7, "y": 1.4, "shape": "triangle-down", "size": "30"}, {"x": 4.5, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 4.9, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 4.0, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.6, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 4.5, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.7, "y": 1.6, "shape": "triangle-down", "size": "30"}, {"x": 3.3, "y": 1.0, "shape": "triangle-down", "size": "30"}, {"x": 4.6, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 3.9, "y": 1.4, "shape": "triangle-down", "size": "30"}, {"x": 3.5, "y": 1.0, "shape": "triangle-down", "size": "30"}, {"x": 4.2, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 4.0, "y": 1.0, "shape": "triangle-down", "size": "30"}, {"x": 4.7, "y": 1.4, "shape": "triangle-down", "size": "30"}, {"x": 3.6, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.4, "y": 1.4, "shape": "triangle-down", "size": "30"}, {"x": 4.5, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 4.1, "y": 1.0, "shape": "triangle-down", "size": "30"}, {"x": 4.5, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 3.9, "y": 1.1, "shape": "triangle-down", "size": "30"}, {"x": 4.8, "y": 1.8, "shape": "triangle-down", "size": "30"}, {"x": 4.0, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.9, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 4.7, "y": 1.2, "shape": "triangle-down", "size": "30"}, {"x": 4.3, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.4, "y": 1.4, "shape": "triangle-down", "size": "30"}, {"x": 4.8, "y": 1.4, "shape": "triangle-down", "size": "30"}, {"x": 5.0, "y": 1.7, "shape": "triangle-down", "size": "30"}, {"x": 4.5, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 3.5, "y": 1.0, "shape": "triangle-down", "size": "30"}, {"x": 3.8, "y": 1.1, "shape": "triangle-down", "size": "30"}, {"x": 3.7, "y": 1.0, "shape": "triangle-down", "size": "30"}, {"x": 3.9, "y": 1.2, "shape": "triangle-down", "size": "30"}, {"x": 5.1, "y": 1.6, "shape": "triangle-down", "size": "30"}, {"x": 4.5, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 4.5, "y": 1.6, "shape": "triangle-down", "size": "30"}, {"x": 4.7, "y": 1.5, "shape": "triangle-down", "size": "30"}, {"x": 4.4, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.1, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.0, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.4, "y": 1.2, "shape": "triangle-down", "size": "30"}, {"x": 4.6, "y": 1.4, "shape": "triangle-down", "size": "30"}, {"x": 4.0, "y": 1.2, "shape": "triangle-down", "size": "30"}, {"x": 3.3, "y": 1.0, "shape": "triangle-down", "size": "30"}, {"x": 4.2, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.2, "y": 1.2, "shape": "triangle-down", "size": "30"}, {"x": 4.2, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 4.3, "y": 1.3, "shape": "triangle-down", "size": "30"}, {"x": 3.0, "y": 1.1, "shape": "triangle-down", "size": "30"}, {"x": 4.1, "y": 1.3, "shape": "triangle-down", "size": "30"}], "key": "petal 1", "yAxis": "1"}, {"values": [{"x": 6.3, "y": 3.3, "shape": "diamond", "size": "10"}, {"x": 5.8, "y": 2.7, "shape": "diamond", "size": "10"}, {"x": 7.1, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 6.3, "y": 2.9, "shape": "diamond", "size": "10"}, {"x": 6.5, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 7.6, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 4.9, "y": 2.5, "shape": "diamond", "size": "10"}, {"x": 7.3, "y": 2.9, "shape": "diamond", "size": "10"}, {"x": 6.7, "y": 2.5, "shape": "diamond", "size": "10"}, {"x": 7.2, "y": 3.6, "shape": "diamond", "size": "10"}, {"x": 6.5, "y": 3.2, "shape": "diamond", "size": "10"}, {"x": 6.4, "y": 2.7, "shape": "diamond", "size": "10"}, {"x": 6.8, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 5.7, "y": 2.5, "shape": "diamond", "size": "10"}, {"x": 5.8, "y": 2.8, "shape": "diamond", "size": "10"}, {"x": 6.4, "y": 3.2, "shape": "diamond", "size": "10"}, {"x": 6.5, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 7.7, "y": 3.8, "shape": "diamond", "size": "10"}, {"x": 7.7, "y": 2.6, "shape": "diamond", "size": "10"}, {"x": 6.0, "y": 2.2, "shape": "diamond", "size": "10"}, {"x": 6.9, "y": 3.2, "shape": "diamond", "size": "10"}, {"x": 5.6, "y": 2.8, "shape": "diamond", "size": "10"}, {"x": 7.7, "y": 2.8, "shape": "diamond", "size": "10"}, {"x": 6.3, "y": 2.7, "shape": "diamond", "size": "10"}, {"x": 6.7, "y": 3.3, "shape": "diamond", "size": "10"}, {"x": 7.2, "y": 3.2, "shape": "diamond", "size": "10"}, {"x": 6.2, "y": 2.8, "shape": "diamond", "size": "10"}, {"x": 6.1, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 6.4, "y": 2.8, "shape": "diamond", "size": "10"}, {"x": 7.2, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 7.4, "y": 2.8, "shape": "diamond", "size": "10"}, {"x": 7.9, "y": 3.8, "shape": "diamond", "size": "10"}, {"x": 6.4, "y": 2.8, "shape": "diamond", "size": "10"}, {"x": 6.3, "y": 2.8, "shape": "diamond", "size": "10"}, {"x": 6.1, "y": 2.6, "shape": "diamond", "size": "10"}, {"x": 7.7, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 6.3, "y": 3.4, "shape": "diamond", "size": "10"}, {"x": 6.4, "y": 3.1, "shape": "diamond", "size": "10"}, {"x": 6.0, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 6.9, "y": 3.1, "shape": "diamond", "size": "10"}, {"x": 6.7, "y": 3.1, "shape": "diamond", "size": "10"}, {"x": 6.9, "y": 3.1, "shape": "diamond", "size": "10"}, {"x": 5.8, "y": 2.7, "shape": "diamond", "size": "10"}, {"x": 6.8, "y": 3.2, "shape": "diamond", "size": "10"}, {"x": 6.7, "y": 3.3, "shape": "diamond", "size": "10"}, {"x": 6.7, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 6.3, "y": 2.5, "shape": "diamond", "size": "10"}, {"x": 6.5, "y": 3.0, "shape": "diamond", "size": "10"}, {"x": 6.2, "y": 3.4, "shape": "diamond", "size": "10"}, {"x": 5.9, "y": 3.0, "shape": "diamond", "size": "10"}], "key": "sepal 2", "yAxis": "1"}, {"values": [{"x": 6.0, "y": 2.5, "shape": "square", "size": "20"}, {"x": 5.1, "y": 1.9, "shape": "square", "size": "20"}, {"x": 5.9, "y": 2.1, "shape": "square", "size": "20"}, {"x": 5.6, "y": 1.8, "shape": "square", "size": "20"}, {"x": 5.8, "y": 2.2, "shape": "square", "size": "20"}, {"x": 6.6, "y": 2.1, "shape": "square", "size": "20"}, {"x": 4.5, "y": 1.7, "shape": "square", "size": "20"}, {"x": 6.3, "y": 1.8, "shape": "square", "size": "20"}, {"x": 5.8, "y": 1.8, "shape": "square", "size": "20"}, {"x": 6.1, "y": 2.5, "shape": "square", "size": "20"}, {"x": 5.1, "y": 2.0, "shape": "square", "size": "20"}, {"x": 5.3, "y": 1.9, "shape": "square", "size": "20"}, {"x": 5.5, "y": 2.1, "shape": "square", "size": "20"}, {"x": 5.0, "y": 2.0, "shape": "square", "size": "20"}, {"x": 5.1, "y": 2.4, "shape": "square", "size": "20"}, {"x": 5.3, "y": 2.3, "shape": "square", "size": "20"}, {"x": 5.5, "y": 1.8, "shape": "square", "size": "20"}, {"x": 6.7, "y": 2.2, "shape": "square", "size": "20"}, {"x": 6.9, "y": 2.3, "shape": "square", "size": "20"}, {"x": 5.0, "y": 1.5, "shape": "square", "size": "20"}, {"x": 5.7, "y": 2.3, "shape": "square", "size": "20"}, {"x": 4.9, "y": 2.0, "shape": "square", "size": "20"}, {"x": 6.7, "y": 2.0, "shape": "square", "size": "20"}, {"x": 4.9, "y": 1.8, "shape": "square", "size": "20"}, {"x": 5.7, "y": 2.1, "shape": "square", "size": "20"}, {"x": 6.0, "y": 1.8, "shape": "square", "size": "20"}, {"x": 4.8, "y": 1.8, "shape": "square", "size": "20"}, {"x": 4.9, "y": 1.8, "shape": "square", "size": "20"}, {"x": 5.6, "y": 2.1, "shape": "square", "size": "20"}, {"x": 5.8, "y": 1.6, "shape": "square", "size": "20"}, {"x": 6.1, "y": 1.9, "shape": "square", "size": "20"}, {"x": 6.4, "y": 2.0, "shape": "square", "size": "20"}, {"x": 5.6, "y": 2.2, "shape": "square", "size": "20"}, {"x": 5.1, "y": 1.5, "shape": "square", "size": "20"}, {"x": 5.6, "y": 1.4, "shape": "square", "size": "20"}, {"x": 6.1, "y": 2.3, "shape": "square", "size": "20"}, {"x": 5.6, "y": 2.4, "shape": "square", "size": "20"}, {"x": 5.5, "y": 1.8, "shape": "square", "size": "20"}, {"x": 4.8, "y": 1.8, "shape": "square", "size": "20"}, {"x": 5.4, "y": 2.1, "shape": "square", "size": "20"}, {"x": 5.6, "y": 2.4, "shape": "square", "size": "20"}, {"x": 5.1, "y": 2.3, "shape": "square", "size": "20"}, {"x": 5.1, "y": 1.9, "shape": "square", "size": "20"}, {"x": 5.9, "y": 2.3, "shape": "square", "size": "20"}, {"x": 5.7, "y": 2.5, "shape": "square", "size": "20"}, {"x": 5.2, "y": 2.3, "shape": "square", "size": "20"}, {"x": 5.0, "y": 1.9, "shape": "square", "size": "20"}, {"x": 5.2, "y": 2.0, "shape": "square", "size": "20"}, {"x": 5.4, "y": 2.3, "shape": "square", "size": "20"}, {"x": 5.1, "y": 1.8, "shape": "square", "size": "20"}], "key": "petal 2", "yAxis": "1"}];
nv.addGraph(function() {
var chart = nv.models.scatterChart();
chart.margin({top: 30, right: 60, bottom: 20, left: 60});
var datum = data_iris_morphology;
chart.xAxis
.tickFormat(d3.format(',.02f'));
chart.yAxis
.tickFormat(d3.format(',.02f'));
chart.showLegend(true);
chart
.showDistX(true)
.showDistY(true)
.color(d3.scale.category10().range());
d3.select('#iris_morphology svg')
.datum(datum)
.transition().duration(500)
.attr('width', 1024)
.attr('height', 600)
.call(chart);
});

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值