Plots
We can also plot most components in phones
.
This only works if phones.plots
is imported after other phones
modules and if
phones was installed with the [plots]
extra dependency.
In [1]:
from phones import PhoneCollection
In [2]:
import phones.plots
In [3]:
pc = PhoneCollection()
Single Phone¶
In [4]:
pc.phones("a").val.plot()
Multiple Phones¶
When plotting multiple phones, its best to use a subset of languages for efficiency. This does principal component analysis on the phone vectors and plots them based on the first and second component.
In [5]:
pc.langs(["eng", "heb"]).plot()
You can also create a 3d plot by changing the number of components to 3.
In [6]:
pc.langs(["eng", "heb"]).plot(n_components=3)
You can use any keyword arguments plotly supports as well.
In [7]:
pc.langs(["eng", "heb"]).plot(n_components=3, width=1000, height=800)
A fourth PCA dimension can be used to vary the size of the points in the 3D plot.
In [8]:
pc.langs(["eng", "heb"]).plot(n_components=4, width=1000, height=800)