码迷,mamicode.com
首页 > 其他好文 > 详细

11.24学习

时间:2017-11-25 00:49:10      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:sig   常用   max   ``   11.2   pix   triangle   print   学习   

1.动态显示图片

可以使用

plt.ion()

for..

   plt.cla()

   plt.plot()..

plt.ioff()

plt.show()

 2.

随机选择n个数

numpy.random.choice(a, size=None, replace=True, p=None)

replace作用未知

3.

numpy中有一些常用的用来产生随机数的函数,randn()和rand()就属于这其中。 
numpy.random.randn(d0, d1, …, dn)是从标准正态分布中返回一个或多个样本值。 
numpy.random.rand(d0, d1, …, dn)的随机样本位于[0, 1)中。

  • 代码:
    1 import numpy as np 
    2     arr1 = np.random.randn(2,4)
    3     print(arr1)
    4     arr2 = np.random.rand(2,4)
    5     print(arr2)

    结果

    1 [[-1.03021018  0.5197033   0.52117459 -0.70102661]
    2  [ 0.98268569  1.21940697 -1.095241   -0.38161758]]
    3 ******************************************************************
    4 [[ 0.19947349  0.05282713  0.56704222  0.45479972]
    5  [ 0.28827103  0.1643551   0.30486786  0.56386943]]

     

4.np.random.shuffle 打乱作用

5.numpy.random.randint(lowhigh=Nonesize=Nonedtype=‘l‘)

Ifhigh is None (the default), then results are from [0, low).

6.numpy.argmax(a, axis=None, out=None) 

不添加时全部元素的最大值,也可指定axis值

7.关于plt.plot中画图参数解析

   ================    ===============================
    character           description
    ================    ===============================
    ``‘-‘``             solid line style
    ``‘--‘``            dashed line style
    ``‘-.‘``            dash-dot line style
    ``‘:‘``             dotted line style
    ``‘.‘``             point marker
    ``‘,‘``             pixel marker
    ``‘o‘``             circle marker
    ``‘v‘``             triangle_down marker
    ``‘^‘``             triangle_up marker
    ``‘<‘``             triangle_left marker
    ``‘>‘``             triangle_right marker
    ``‘1‘``             tri_down marker
    ``‘2‘``             tri_up marker
    ``‘3‘``             tri_left marker
    ``‘4‘``             tri_right marker
    ``‘s‘``             square marker
    ``‘p‘``             pentagon marker
    ``‘*‘``             star marker
    ``‘h‘``             hexagon1 marker
    ``‘H‘``             hexagon2 marker
    ``‘+‘``             plus marker
    ``‘x‘``             x marker
    ``‘D‘``             diamond marker
    ``‘d‘``             thin_diamond marker
    ``‘|‘``             vline marker
    ``‘_‘``             hline marker
    ================    ===============================
    
    
    The following color abbreviations are supported:
    
    ==========  ========
    character   color
    ==========  ========
    ‘b‘         blue
    ‘g‘         green
    ‘r‘         red
    ‘c‘         cyan
    ‘m‘         magenta
    ‘y‘         yellow
    ‘k‘         black
    ‘w‘         white
    ==========  ========

  

 

技术分享图片

11.24学习

标签:sig   常用   max   ``   11.2   pix   triangle   print   学习   

原文地址:http://www.cnblogs.com/hao-sir/p/7892643.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!