import pandas as pd
from lets_plot.bistro import *
from lets_plot import *
LetsPlot.setup_html()
df = pd.read_csv("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/iris.csv")
print(df.shape)
df.head()
(150, 5)
sepal_length | sepal_width | petal_length | petal_width | species | |
---|---|---|---|---|---|
0 | 5.1 | 3.5 | 1.4 | 0.2 | setosa |
1 | 4.9 | 3.0 | 1.4 | 0.2 | setosa |
2 | 4.7 | 3.2 | 1.3 | 0.2 | setosa |
3 | 4.6 | 3.1 | 1.5 | 0.2 | setosa |
4 | 5.0 | 3.6 | 1.4 | 0.2 | setosa |
In the simplest case, assign x
and y
to create a scatterplot (using geom_point()
) with marginal histograms (using geom_histogram()
).
joint_plot(df, "petal_length", "petal_width")
Besides the points there are another two types of geoms: tile
and density2d(f)
.
joint_plot(df, "petal_length", "petal_width", geom='tile')
joint_plot(df.dropna(), "petal_length", "petal_width", color_by="species", geom='density2d')