美文网首页
自动计算数据

自动计算数据

作者: sbill | 来源:发表于2017-04-03 22:27 被阅读0次
    import matplotlib.pyplot as plt 
    
    x_values = list(range(1, 1001))
    y_values = [x**2 for x in x_values]
    
    plt.scatter(x_values, y_values, c='red', edgecolor='none', s=1)
    
    #设置图表标题并给坐标轴加上书签
    plt.title('Squares', fontsize=24)
    plt.xlabel('Value', fontsize=14)
    plt.ylabel('Squares of value', fontsize=14)
    
    #设置每个坐标轴的取值范围
    plt.axis([0, 1100, 0, 1100000])
    
    plt.show()
    
    Paste_Image.png

    使用颜色映射:plt.scatter(x_values, y_values, c=y_values, cmap=plt.cm.Blues, edgecolor='none', s=1)

    Paste_Image.png

    相关文章

      网友评论

          本文标题:自动计算数据

          本文链接:https://www.haomeiwen.com/subject/akooottx.html