Skip to content
Snippets Groups Projects
Commit 623b0307 authored by Blaise Li's avatar Blaise Li
Browse files

Added top 25% gene lists.

parent 77ea577f
No related branches found
No related tags found
No related merge requests found
...@@ -244,6 +244,9 @@ def violin_with_thresh(data, thresh, ylabel, ...@@ -244,6 +244,9 @@ def violin_with_thresh(data, thresh, ylabel,
""" """
Draw a violin plot from *data* with a horizontal line at value *thresh*. Draw a violin plot from *data* with a horizontal line at value *thresh*.
If *thresh* is a single value, the line will be red.
If *thresh* contains pairs, it will be assumed that these
are (threshold, colour) pairs, to be used to plot various lines.
Y-axis will be labeled using *ylabel*. Y-axis will be labeled using *ylabel*.
""" """
if axis is None: if axis is None:
...@@ -253,9 +256,14 @@ def violin_with_thresh(data, thresh, ylabel, ...@@ -253,9 +256,14 @@ def violin_with_thresh(data, thresh, ylabel,
[body] = violin_parts["bodies"] [body] = violin_parts["bodies"]
body.set_facecolor(facecolor) body.set_facecolor(facecolor)
body.set_edgecolor("black") body.set_edgecolor("black")
axis.axhline(thresh, color="red") try:
(val, col) = thresh[0]
except TypeError:
thresh = [(thresh, "red")]
for (val, col) in thresh:
axis.axhline(val, color=col)
axis.text( axis.text(
1.01, thresh, f"{thresh:.3}", 1.01, val, f"{val:.3}",
horizontalalignment="left", verticalalignment="bottom") horizontalalignment="left", verticalalignment="bottom")
(q0, q1, median, q3, q4) = np.percentile( # pylint: disable=C0103 (q0, q1, median, q3, q4) = np.percentile( # pylint: disable=C0103
data, [0, 25, 50, 75, 100]) data, [0, 25, 50, 75, 100])
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment