Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcodonusage
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Blaise LI
libcodonusage
Commits
b2ea4106
Commit
b2ea4106
authored
3 years ago
by
Blaise Li
Browse files
Options
Downloads
Patches
Plain Diff
Further forward violin plot kwargs.
parent
14de21d2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcodonusage/libcodonusage.py
+9
-5
9 additions, 5 deletions
libcodonusage/libcodonusage.py
with
9 additions
and
5 deletions
libcodonusage/libcodonusage.py
+
9
−
5
View file @
b2ea4106
...
...
@@ -1230,7 +1230,7 @@ def violin_usage_vertical(
def
violin_usage_by_clusters
(
usage_with_clusters
,
aa
,
# pylint: disable=C0103
ylabel_template
,
cluster_level_template
=
"
cluster_{aa}
"
,
vertical
=
False
):
vertical
=
False
,
**
violin_kwargs
):
"""
Plot a series of violin plots for each cluster of genes.
...
...
@@ -1252,16 +1252,18 @@ def violin_usage_by_clusters(usage_with_clusters, aa, # pylint: disable=C0103
nrows
=
clusters
.
ngroups
,
figsize
=
(
18
,
6
*
clusters
.
ngroups
))
for
((
cluster
,
usage_table
),
axis
)
in
zip
(
clusters
,
axes
):
kwargs
=
{
"
axis
"
:
axis
}
kwargs
.
update
(
violin_kwargs
)
if
vertical
:
violin_usage_vertical
(
usage_table
,
"
codon
"
,
ylabel_template
.
format
(
aa
=
aa
,
cluster
=
cluster
),
axis
=
axi
s
)
**
kwarg
s
)
else
:
violin_usage
(
usage_table
,
"
codon
"
,
ylabel_template
.
format
(
aa
=
aa
,
cluster
=
cluster
),
axis
=
axi
s
)
**
kwarg
s
)
# Based on
...
...
@@ -1280,7 +1282,7 @@ def adjacent_values(q0, q1, q3, q4): # pylint: disable=C0103
def
violin_with_thresh
(
data
,
thresh
,
ylabel
,
facecolor
=
"
grey
"
,
axis
=
None
):
facecolor
=
"
grey
"
,
axis
=
None
,
**
violin_kwargs
):
"""
Draw a violin plot from *data* with a horizontal line at value *thresh*.
...
...
@@ -1291,7 +1293,9 @@ def violin_with_thresh(data, thresh, ylabel,
"""
if
axis
is
None
:
_
,
axis
=
plt
.
subplots
(
figsize
=
(
2
,
3.5
))
violin_parts
=
axis
.
violinplot
(
data
,
showextrema
=
False
)
kwargs
=
{
"
showextrema
"
:
False
}
kwargs
.
update
(
violin_kwargs
)
violin_parts
=
axis
.
violinplot
(
data
,
**
kwargs
)
# https://stackoverflow.com/a/26291582/1878788
[
body
]
=
violin_parts
[
"
bodies
"
]
body
.
set_facecolor
(
facecolor
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment