zoukankan      html  css  js  c++  java
  • matplotlib与numpy

    import matplotlib.pyplot as plt
    import numpy as np

    y = df.loc[0:100, 4].values
    y = np.where(y == 'Iris-setosa',-1,1)
    X = df.iloc[0:100,[0,2]].values

    plt.scatter(X[:50,0], X[:50,1], color='red', marker='o', label='setosa')
    plt.scatter(X[50:100,0], X[50:100,1], color='blue', marker='x', label='versicolor')
    plt.xlabel("花瓣长度")
    plt.ylabel("花径长度")
    plt.legend(loc='upper left')
    plt.show()

    代码补寄:

    plt.scatter中color参数:

    ‘b’          blue             蓝色

    ‘g’          green           绿色

    ‘r’          red               红色

    ‘c’          cyan             青色

    ‘y’          yellow           黄色

    ‘k’          black            黑色

    ‘w’          white            白色

    ‘m’          magenta      品红

    marker参数:

     

  • 相关阅读:
    html----有关图像
    前端开发初学者
    angular js 正序倒叙
    viewpager无线轮播获取网络图片
    angular js 球星
    angular js shopping
    angular js 公告墙
    Android 常用正则表达式
    Android 内存泄漏
    TCP/IP,必知必会的
  • 原文地址:https://www.cnblogs.com/3daytears/p/8890412.html
Copyright © 2011-2022 走看看