I created a violinplot with matplotlib. Now, I would like to reduce the horizontal length of the two lines for the minimal and maximum values. How can I do that?
Here is my code. The code is reduced to the necessary information for a better overview.
# Initialize
import matplotlib.pyplot as plt
import numpy as np
import statistics
# Creation of violinplots
Core_values = np.loadtxt("pathtofile/xyz.txt", comments=None, delimiter=None, converters=None, skiprows=0, usecols=0,
unpack=False, ndmin=0, encoding=None, max_rows=None, like=None)
Core = plt.violinplot(Core_values, positions=[0], points=500)
# Look of the violinplot
for vp in Core["bodies"]:
vp.set_facecolor("cornflowerblue")
vp.set_zorder(2)
vp.set_alpha(1)
vp.set_linewidth(1)
for vp_part in ("cbars", "cmins", "cmaxes"):
vp = Core[vp_part]
vp.set_edgecolor("black")
plt.show()
The screenshot below shows what I mean: the top and bottom black line of the violinplot. I would like to decrease their horizontal length.
CodePudding user response: