当前位置: 首页>>代码示例>>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;未经允许,请勿转载。