from beeswarm import * help(beeswarm) from beeswarm import * import matplotlib.pyplot as plt import numpy as np d1 = np.random.uniform(low=-3, high=3, size=100) d2 = np.random.normal(size=100) bs, ax = beeswarm([d1,d2], method="swarm", labels=["sample 1", "sample 2"], col=["blue","red"]) from beeswarm import beeswarm import matplotlib.pyplot as plt import numpy as np d1 = np.random.uniform(low=-3, high=3, size=100) d2 = np.random.normal(size=100) fig = plt.figure() fig.set_size_inches((8,8)) ax1 = plt.subplot(221) ax2 = plt.subplot(222) ax3 = plt.subplot(223) ax4 = plt.subplot(224) axes = [ax1, ax2, ax3, ax4] methods = ["swarm","center","square","hex"] for i in range(len(axes)): beeswarm([d1, d2], col=["black","red"], method=methods[i], ax=axes[i], labels=["Uniform","Normal"]) axes[i].set_title("Method: %s"%methods[i], size=15) plt.tight_layout() fig = plt.figure() fig.set_size_inches((8,8)) ax1 = plt.subplot(221) ax2 = plt.subplot(222) ax3 = plt.subplot(223) ax4 = plt.subplot(224) beeswarm([d1,d2], method="swarm", labels=["Uniform","Normal"], col="black", ax=ax1) beeswarm([d1,d2], method="swarm", labels=["Uniform","Normal"], col=["black","red"], ax=ax2) def GetColor(x): colors = [] for item in x: if item > 0: colors.append("red") else: colors.append("blue") return colors colors = GetColor(d1) + GetColor(d2) beeswarm([d1,d2], method="swarm", labels=["Uniform","Normal"], col=colors, ax=ax3) beeswarm([d1,d2], method="swarm", labels=["Uniform","Normal"], col=["red","blue","orange"], ax=ax4) plt.tight_layout()