In [1]:
%pylab inline
In [2]:
from beeswarm import *
import numpy as np
In [3]:
d1 = np.random.normal(size=100)
In [4]:
beeswarm([d1], method="swarm");
In [5]:
beeswarm([d1], method="hex");
In [6]:
beeswarm([d1], method="center");
In [7]:
beeswarm([d1], method="square");
In [8]:
beeswarm(d1);
In [9]:
beeswarm([d1, d1]);
In [10]:
beeswarm([d1]*4);
In [11]:
d2 = np.random.uniform(low=-5, high=0, size=100)
beeswarm([d1,d1,d2], positions=[1,2, 5], labels=["test1","test2","test3"], col=["red","green","orange"]);
In [12]:
beeswarm([d1,d2,d2], xlim=(-2,5), ylim=(-6,6));
In [13]:
beeswarm([d1,d2,d2], xlim=(-2,5));
In [14]:
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_xlim(left=-2, right=6)
ax.set_ylim(bottom=-10, top=10)
bs, ax = beeswarm([d1,d1,d2,d2], positions=[0,3,5,6], ax=ax, col=["red","orange","yellow"]);
ax.set_xlabel("testing x")
Out[14]:
In [15]:
bs.head()
Out[15]:
In [16]:
beeswarm([])
In [17]:
beeswarm([d1], positions=[])
In [18]:
beeswarm([d1], method="dummy")
In [19]:
beeswarm([d1], col=2)
In [20]:
d1 = np.random.normal(size=100)
d2 = np.random.normal(loc=1, size=100)
d3 = np.random.normal(scale=2, size=100)
d4 = np.random.uniform(low=-3, high=3, size=100)
bs, ax = beeswarm([d1,d2,d3,d4], col=["red","orange","yellow"], labels=["N(0,1)", "N(1,1)", "N(0,2)","Unif(-3,3)"])
ax.set_xticklabels(["N(0,1)", "N(1,1)", "N(0,2)","Unif(-3,3)"], size=15);
ax.set_yticklabels(np.arange(-4,7,2), size=15);
plt.savefig("example.png")