Skip to content

Commit 895e918

Browse files
committed
added new
1 parent c54ee95 commit 895e918

2 files changed

Lines changed: 89 additions & 0 deletions

File tree

examples/another_usage.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import pandas as pd
2+
import matplotlib.pyplot as plt
3+
from fishplotpy import FishPlotData, fishplot, draw_legend
4+
5+
timepoints = [0.0, 2.0, 3.0, 4.0]
6+
frac_table = pd.DataFrame([
7+
[15, 40, 50, 100],
8+
[1, 15, 20, 60],
9+
[ 1, 5, 20, 20],
10+
[ 0, 0, 3, 20]
11+
], columns=timepoints)
12+
parents = [0, 1, 1, 3] # first root (0), second and third inside the first one, fourth is inside the third one.
13+
14+
custom_labels = ["Founder (WT)", "Gain(Chr3)", "Mut(GeneA)", "DoubleHit+Resist"]
15+
custom_colors = ['#FFFFFF', '#4682B4', '#FF4500', '#2E8B57']
16+
17+
custom_annots_base = ["First", "Second", "Third", "Fourth"]
18+
19+
fish_data = FishPlotData(
20+
frac_table=frac_table,
21+
parents=parents,
22+
timepoints=timepoints,
23+
clone_labels=custom_labels,
24+
colors=custom_colors,
25+
clone_annots=custom_annots_base,
26+
clone_annots_angle=45,
27+
clone_annots_pos=5,
28+
clone_annots_offset=0.6,
29+
clone_annots_col='#111111',
30+
clone_annots_cex=0.9
31+
)
32+
33+
fish_data.layout_clones()
34+
35+
fig, ax = plt.subplots(figsize=(9, 6.5))
36+
fig.subplots_adjust(left=0.05, right=0.95, bottom=0.22, top=0.88)
37+
38+
fishplot(
39+
fish_data,
40+
ax=ax,
41+
shape="spline",
42+
pad_left_frac=0.1,
43+
vlines=timepoints,
44+
vlab=[f"T={int(t)}" for t in timepoints],
45+
cex_vlab=0.75,
46+
col_vline="#cccccc",
47+
border=0.6,
48+
col_border="#666666",
49+
bg_type='solid',
50+
bg_col='#f0f0f0',
51+
use_annot_outline=True
52+
)
53+
54+
ax.set_title("Muller Graphs Testing", fontsize=14, weight='bold', pad=25)
55+
56+
ax.text(ax.get_xlim()[0] - fish_data.timepoints[-1]*0.02, 50, 'Clonal Fraction (%)',
57+
ha='right', va='center', fontsize=9, rotation=90, color='#444444')
58+
59+
draw_legend(
60+
fish_data,
61+
fig=fig,
62+
ncol=4,
63+
frameon=True,
64+
title="Clone Identity",
65+
loc='upper center',
66+
bbox_to_anchor=(0.5, 0.15),
67+
cex=0.9
68+
)
69+
70+
plt.show()

requirements.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
contourpy==1.3.1
2+
cycler==0.12.1
3+
fonttools==4.57.0
4+
iniconfig==2.1.0
5+
Jinja2==3.1.6
6+
kiwisolver==1.4.8
7+
MarkupSafe==3.0.2
8+
matplotlib==3.10.1
9+
numpy==2.2.4
10+
packaging==24.2
11+
pandas==2.2.3
12+
pillow==11.1.0
13+
pluggy==1.5.0
14+
pyparsing==3.2.3
15+
python-dateutil==2.9.0.post0
16+
pytz==2025.2
17+
scipy==1.15.2
18+
six==1.17.0
19+
tzdata==2025.2

0 commit comments

Comments
 (0)