當前位置: 首頁>>代碼示例>>Python>>正文


Python pyplot.violinplot方法代碼示例

本文整理匯總了Python中matplotlib.pyplot.violinplot方法的典型用法代碼示例。如果您正苦於以下問題:Python pyplot.violinplot方法的具體用法?Python pyplot.violinplot怎麽用?Python pyplot.violinplot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.pyplot的用法示例。


在下文中一共展示了pyplot.violinplot方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: figure_2_1

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def figure_2_1():
    plt.violinplot(dataset=np.random.randn(200, 10) + np.random.randn(10))
    plt.xlabel("Action")
    plt.ylabel("Reward distribution")
    plt.savefig('../images/figure_2_1.png')
    plt.close() 
開發者ID:ShangtongZhang,項目名稱:reinforcement-learning-an-introduction,代碼行數:8,代碼來源:ten_armed_testbed.py

示例2: test_vert_violinplot_baseline

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_vert_violinplot_baseline():
    # First 9 digits of frac(sqrt(2))
    np.random.seed(414213562)
    data = [np.random.normal(size=100) for i in range(4)]
    ax = plt.axes()
    ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
                  showmedians=0)

    # Reuse testcase from above for a labeled data test
    data = {"d": data}
    fig, ax = plt.subplots()
    ax = plt.axes()
    ax.violinplot("d", positions=range(4), showmeans=0, showextrema=0,
                  showmedians=0, data=data) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:16,代碼來源:test_axes.py

示例3: test_vert_violinplot_showmeans

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_vert_violinplot_showmeans():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(3))
    np.random.seed(732050807)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), showmeans=1, showextrema=0,
                  showmedians=0) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例4: test_vert_violinplot_showextrema

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_vert_violinplot_showextrema():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(5))
    np.random.seed(236067977)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), showmeans=0, showextrema=1,
                  showmedians=0) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例5: test_vert_violinplot_showmedians

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_vert_violinplot_showmedians():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(7))
    np.random.seed(645751311)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
                  showmedians=1) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例6: test_vert_violinplot_showall

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_vert_violinplot_showall():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(11))
    np.random.seed(316624790)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), showmeans=1, showextrema=1,
                  showmedians=1) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例7: test_vert_violinplot_custompoints_200

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_vert_violinplot_custompoints_200():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(17))
    np.random.seed(123105625)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
                  showmedians=0, points=200) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例8: test_horiz_violinplot_baseline

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_horiz_violinplot_baseline():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(19))
    np.random.seed(358898943)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
                  showextrema=0, showmedians=0) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例9: test_horiz_violinplot_showmedians

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_horiz_violinplot_showmedians():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(23))
    np.random.seed(795831523)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
                  showextrema=0, showmedians=1) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例10: test_horiz_violinplot_showmeans

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_horiz_violinplot_showmeans():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(29))
    np.random.seed(385164807)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), vert=False, showmeans=1,
                  showextrema=0, showmedians=0) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例11: test_horiz_violinplot_showextrema

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_horiz_violinplot_showextrema():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(31))
    np.random.seed(567764362)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
                  showextrema=1, showmedians=0) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例12: test_horiz_violinplot_custompoints_10

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_horiz_violinplot_custompoints_10():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(41))
    np.random.seed(403124237)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
                  showextrema=0, showmedians=0, points=10) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例13: test_horiz_violinplot_custompoints_200

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_horiz_violinplot_custompoints_200():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(43))
    np.random.seed(557438524)
    data = [np.random.normal(size=100) for i in range(4)]
    ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
                  showextrema=0, showmedians=0, points=200) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例14: test_violinplot_bad_positions

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_violinplot_bad_positions():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(47))
    np.random.seed(855654600)
    data = [np.random.normal(size=100) for i in range(4)]
    with pytest.raises(ValueError):
        ax.violinplot(data, positions=range(5)) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py

示例15: test_violinplot_bad_widths

# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import violinplot [as 別名]
def test_violinplot_bad_widths():
    ax = plt.axes()
    # First 9 digits of frac(sqrt(53))
    np.random.seed(280109889)
    data = [np.random.normal(size=100) for i in range(4)]
    with pytest.raises(ValueError):
        ax.violinplot(data, positions=range(4), widths=[1, 2, 3]) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_axes.py


注:本文中的matplotlib.pyplot.violinplot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。