Skip to content

Commit d1f67fd

Browse files
committed
Add new examples
1 parent a5ad0c1 commit d1f67fd

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

examples/horizontal_boxplot.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
Horizontal boxplot with log axis
3+
================================
4+
5+
_thumb: .6, .5
6+
"""
7+
import numpy as np
8+
import seaborn as sns
9+
sns.set(style="ticks", palette="muted", color_codes=True)
10+
11+
# Load the example planets dataset
12+
planets = sns.load_dataset("planets")
13+
14+
# Plot the orbital period with horizontal boxes
15+
ax = sns.boxplot(x="orbital_period", y="method", data=planets,
16+
whis=np.inf, color="c")
17+
18+
# Make the quantitative axis logarithmic
19+
ax.set_xscale("log")
20+
sns.despine(left=True)

examples/scatterplot_categorical.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
Scatterplot with categorical variables
3+
4+
"""
5+
import pandas as pd
6+
import seaborn as sns
7+
sns.set(style="whitegrid", palette="pastel")
8+
9+
# Load the example iris dataset
10+
iris = sns.load_dataset("iris")
11+
12+
# "Melt" the dataset to "long-form" or "tidy" representation
13+
iris = pd.melt(iris, "species", var_name="measurement")
14+
15+
# Draw a categorical scatterplot to show each observation
16+
sns.stripplot(x="measurement", y="value", hue="species", data=iris,
17+
jitter=True, edgecolor="gray")

examples/simple_violinplots.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@
1818
pal = sns.cubehelix_palette(p, rot=-.5, dark=.3)
1919

2020
# Show each distribution with both violins and points
21-
sns.violinplot(data=d, palette=pal, inner=None)
22-
sns.stripplot(data=d, palette=pal, jitter=True)
21+
sns.violinplot(data=d, palette=pal, inner="points")

0 commit comments

Comments
 (0)