Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Carlos GO
mateRNAl
Commits
83672fbc
Commit
83672fbc
authored
Jan 12, 2019
by
Carlos GO
Browse files
line colors
parent
ffb38ec2
Changes
1
Hide whitespace changes
Inline
Side-by-side
plot.py
View file @
83672fbc
...
...
@@ -6,12 +6,24 @@ import pandas as pd
plt
.
style
.
use
(
'fivethirtyeight'
)
labels
=
{
'orig'
:
'original'
,
fivethirtyeight
=
[
c
[
'color'
]
for
c
in
list
(
plt
.
rcParams
[
'axes.prop_cycle'
])]
color_wheel
=
fivethirtyeight
labels
=
{
'orig2'
:
r
'$\beta=1$'
,
'gamma_b0_b0'
:
r
'$\beta=0$'
,
'gamma_002'
:
r
'$\beta=1$'
,
'lin2'
:
'energy-mut'
,
'gamma_emut'
:
'energy-mut'
,
'norm'
:
'gauss-fitness'
,
'nosel3'
:
'no-selecion'
,
'gamma_gauss'
:
'gauss-fitness'
,
'nosel3'
:
r
'$\beta=0$'
,
'unp'
:
'unpaired-objective'
,
'beta01'
:
'beta=0.1'
}
'beta01'
:
r
'$\beta=0.1$'
,
'beta001'
:
r
'$\beta=0.01$'
,
'beta05'
:
r
'$\beta=0.05$'
,
'unp10'
:
'unpaired fitness'
}
gc_labels
=
{
g
:
g
[::
-
1
]
for
g
in
[
'01'
,
'03'
,
'05'
,
'07'
,
'09'
]}
def
maternal_plot
(
exps
,
feature
=
'multi'
,
mode
=
'mutations'
):
for
e
in
exps
:
...
...
@@ -22,29 +34,61 @@ def maternal_plot(exps, feature='multi', mode='mutations'):
plt
.
legend
()
plt
.
tight_layout
()
plt
.
show
()
pass
pass
def
generation_window
(
feat
,
window_size
=
20
):
binned
=
[
np
.
mean
(
feat
[
i
:
i
+
window_size
])
for
i
in
np
.
arange
(
0
,
len
(
feat
),
window_size
)]
return
binned
def
subfigs
(
exps
,
dim1
,
dim2
,
mode
=
'mutations'
,
feature
=
'multi'
):
count
=
1
modes
=
[
'mutations'
,
'generation'
]
features
=
[
'multi'
,
'energy'
,
'entropy'
]
ax
=
plt
.
subplot
(
111
)
for
mode
in
modes
:
for
feature
in
features
:
plt
.
subplot
(
len
(
modes
),
len
(
features
),
count
)
count
+=
1
for
e
in
exps
:
df
=
pd
.
read_csv
(
f
"Data/
{
e
}
_df_
{
mode
}
_mean.csv"
)
for
i
,
e
in
enumerate
(
exps
):
gc
=
e
.
split
(
'_'
)[
-
1
]
df
=
pd
.
read_csv
(
f
"betas/
{
e
}
_df_
{
mode
}
_mean.csv"
)
if
mode
==
'generation'
:
plt
.
plot
(
df
[
feature
][:
1000
],
label
=
f
'
{
labels
[
e
]
}
'
)
xx
=
generation_window
(
df
[
feature
][:
1000
])
# plt.plot(xx, label=f'{labels[e[:-3]]}')
plt
.
plot
(
xx
,
label
=
f
'
{
e
}
'
)
# plt.plot(xx, label=gc_labels[gc])
locs
=
np
.
linspace
(
0
,
len
(
xx
),
3
)
print
(
locs
)
plt
.
xticks
(
locs
,
np
.
arange
(
0
,
1001
,
500
))
else
:
plt
.
plot
(
df
[
feature
],
label
=
f
'
{
labels
[
e
]
}
'
)
# plt.plot(df[feature], label=f'{labels[e[:-3]]}')
plt
.
plot
(
df
[
feature
],
label
=
f
'
{
e
}
'
)
# plt.plot(df[feature], label=gc_labels[gc])
plt
.
xticks
([
0
,
50
],
[
0
,
50
])
plt
.
ylabel
(
feature
)
plt
.
xlabel
(
mode
)
plt
.
legend
()
# plt.legend(bbox_to_anchor=(-1.5,-.2), ncol=5, prop={'size': 7})
g
=
exps
[
0
][
-
2
:][::
-
1
]
# plt.suptitle(f"GC: {g}")
plt
.
suptitle
(
f
"GC: 90"
)
plt
.
legend
(
prop
=
{
'size'
:
8
}
)
plt
.
tight_layout
()
# plt.savefig(f'gamma_{g}.pdf', format='pdf')
plt
.
savefig
(
"betas_09_trans.pdf"
,
format
=
"pdf"
)
plt
.
show
()
if
__name__
==
"__main__"
:
exps
=
[
'beta01'
,
'unp'
,
'nosel3'
,
'norm'
,
'lin2'
]
# maternal_plot(exps, feature='entropy')
# exps = [ 'beta01', 'orig2', 'nosel3', 'norm']
# exps = ['nosel3', 'norm', 'lin2', 'orig2']
# exps = ['gamma_b0_b0_01', 'gamma_b0_b0_03', 'gamma_b0_b0_05', 'gamma_b0_b0_07', 'gamma_b0_b0_09']
# exps = ['gamma_gauss_01', 'gamma_gauss_03', 'gamma_gauss_05', 'gamma_gauss_07', 'gamma_gauss_09']
# exps = ['gamma_002_01', 'gamma_002_03', 'gamma_002_05', 'gamma_002_07', 'gamma_002_09']
exps
=
[
f
'exp_bs09_
{
b
}
'
for
b
in
[
'001'
,
'002'
,
'003'
,
'004'
,
'005'
]]
subfigs
(
exps
,
2
,
3
)
# for g in ['01', '03', '05', '07', '09']:
# exps = [f'gamma_002_{g}', f'gamma_b0_b0_{g}',
# f'gamma_gauss_{g}', f'gamma_emut_{g}']
# subfigs(exps, 2, 3)
# maternal_plot(exps, feature='entropy')
# maternal_plot(exps, feature='entropy')
# subfigs(exps, 2, 3)
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment