Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Ludovic PLATON
/
IRSOM
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ludovic PLATON
2018-02-26 14:49:08 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
75fb962fb38055382b6aff60d1c8c90f862ab5e1
75fb962f
1 parent
6eeffeec
Update util.py
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
14 deletions
scripts/SLSOM/util.py
scripts/SLSOM/util.py
View file @
75fb962
...
...
@@ -42,21 +42,9 @@ def import_ncRNA(path):
'''
Plot function
'''
def
colors_fn
(
nb
):
hsv
=
plt
.
get_cmap
(
'hsv'
)
return
cm
.
rainbow
(
np
.
linspace
(
0
,
1
,
nb
))
def
make_autopct
(
pct
,
values
):
total
=
sum
(
values
)
val
=
int
(
round
(
pct
*
total
/
100.0
))
return
'{p:.2f}
%
({v:d})'
.
format
(
p
=
pct
,
v
=
val
)
def
plot_repartition
(
data
,
m
,
n
,
name
):
labels_names
=
[
"rej1"
if
x
==-
1
else
"rej2"
if
x
==-
2
else
str
(
x
)
for
x
in
data
[
0
]]
labels_names
=
[
str
(
x
)
for
x
in
data
[
0
]]
repartition
=
data
[
1
]
nb_label
=
len
(
data
[
0
][
data
[
0
]
>=
0
])
+
2
colors_raw
=
colors_fn
(
nb_label
)
colors
=
[
'#
%02
x
%02
x
%02
x'
%
(
255
*
x
[
0
],
255
*
x
[
1
],
255
*
x
[
2
])
for
x
in
colors_raw
]
dico
=
[]
for
i
in
range
(
m
):
for
j
in
range
(
n
):
...
...
@@ -75,7 +63,6 @@ def plot_repartition(data,m,n,name):
p
+=
scale_x_discrete
(
name
=
""
,
limits
=
"1"
,
labels
=
[
""
])
p
+=
xlab
(
""
)
p
+=
ylab
(
""
)
p
+=
scale_fill_manual
(
values
=
colors
)
check_dir_file
(
name
)
p
.
save
(
name
+
".png"
,
width
=
6
,
height
=
7
)
...
...
Please
register
or
login
to post a comment