Have been trying to add one single point to my boxplots. I would like just to add a point as the black ones in the image below.
data_2 = [pd.read_csv(data).values for data in os.listdir(wd)]
bp = plt.boxplot(data_2, labels = labels, vert = False, showfliers = False)
plt.show()
Any ideas for how I should go with that? You can click here to see the pic

You can just plot individual points after the boxplot is finished, just give the appropiate coordinates:
import numpy as np
import matplotlib.pyplot as plt
data = np.array( [
np.random.normal( 0.19, 0.1, 100 ),
np.random.normal( 0.17, 0.1, 100 ),
np.random.normal( 0.11, 0.1, 100 ),
np.random.normal( 0.16, 0.1, 100 ),
np.random.normal( 0.15, 0.1, 100 ) ] ).T
labels = [ 'pred2012', 'pred2007', 'pred2002', 'pred1995', 'pred1988' ]
fig, ax = plt.subplots()
ax.boxplot( data, labels=labels, vert = False, showfliers = False)
ax.plot( -0.1, 4, marker='o' )
ax.plot( 0.3, 3, marker='*', markersize=20 )
plt.savefig( 'boxplot.png' )
plt.show()

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With