本文整理汇总了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()
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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))
示例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])