Skip to content

Commit 7c4cb5a

Browse files
authored
Merge pull request #34 from kpj/feature-test
Add test including both seaborn and plotnine
2 parents c81c769 + b98dace commit 7c4cb5a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_patchworklib.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pathlib import Path
22

3+
import plotnine as p9
34
import seaborn as sns
45

56
import patchworklib as pw
@@ -25,3 +26,26 @@ def test_example_plot(tmp_path: Path):
2526
ax12 = ax1 | ax2
2627
ax12.savefig(result_file)
2728
assert result_file.exists()
29+
30+
31+
def test_sns_and_p9(tmp_path: Path):
32+
titanic = sns.load_dataset("titanic")
33+
34+
g_sns = pw.Brick(figsize=(4, 4))
35+
sns.boxplot(data=titanic, x="sex", y="survived", hue="class", ax=g_sns)
36+
g_sns.set_title("seaborn")
37+
38+
g_p9 = pw.load_ggplot(
39+
(
40+
p9.ggplot(titanic, p9.aes(x="sex", y="survived", fill="class"))
41+
+ p9.geom_boxplot()
42+
+ p9.ggtitle("plotnine")
43+
),
44+
figsize=(4, 4),
45+
)
46+
47+
g = g_sns | g_p9
48+
49+
result_file = tmp_path / "g.png"
50+
g.savefig(result_file)
51+
assert result_file.exists()

0 commit comments

Comments
 (0)