Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Blaise LI
libhts
Commits
785b0089
Commit
785b0089
authored
Dec 15, 2017
by
Blaise Li
Browse files
Better handling of empty data in scatterplots.
parent
06c17d33
Changes
1
Hide whitespace changes
Inline
Side-by-side
libhts/libhts.py
View file @
785b0089
...
...
@@ -396,9 +396,16 @@ def plot_MA(res,
else
:
(
status
,
colour
)
=
group2colour
row_indices
=
data
.
index
.
intersection
(
grouping
)
data
.
ix
[
row_indices
].
plot
.
scatter
(
x
=
x_column
,
y
=
y_column
,
s
=
1
,
logx
=
True
,
c
=
colour
,
label
=
f
"
{
status
}
(
{
len
(
row_indices
)
}
)"
,
ax
=
ax
)
try
:
data
.
ix
[
row_indices
].
plot
.
scatter
(
x
=
x_column
,
y
=
y_column
,
s
=
1
,
logx
=
True
,
c
=
colour
,
label
=
f
"
{
status
}
(
{
len
(
row_indices
)
}
)"
,
ax
=
ax
)
except
ValueError
as
e
:
if
str
(
e
)
!=
"scatter requires x column to be numeric"
:
print
(
data
.
ix
[
row_indices
])
raise
else
:
warnings
.
warn
(
f
"Nothing to plot for
{
status
}
\n
"
)
ax
.
axhline
(
y
=
1
,
linewidth
=
0.5
,
color
=
"0.5"
,
linestyle
=
"dashed"
)
ax
.
axhline
(
y
=-
1
,
linewidth
=
0.5
,
color
=
"0.5"
,
linestyle
=
"dashed"
)
# TODO: check data basemean range
...
...
@@ -454,9 +461,16 @@ def plot_scatter(data,
# Apply a coulour to a list of genes
(
status
,
colour
)
=
group2colour
row_indices
=
data
.
index
.
intersection
(
grouping
)
data
.
ix
[
row_indices
].
plot
.
scatter
(
x
=
x_column
,
y
=
y_column
,
s
=
1
,
c
=
colour
,
label
=
f
"
{
status
}
(
{
len
(
row_indices
)
}
)"
,
ax
=
ax
)
try
:
data
.
ix
[
row_indices
].
plot
.
scatter
(
x
=
x_column
,
y
=
y_column
,
s
=
1
,
c
=
colour
,
label
=
f
"
{
status
}
(
{
len
(
row_indices
)
}
)"
,
ax
=
ax
)
except
ValueError
as
e
:
if
str
(
e
)
!=
"scatter requires x column to be numeric"
:
print
(
data
.
ix
[
row_indices
])
raise
else
:
warnings
.
warn
(
f
"Nothing to plot for
{
status
}
\n
"
)
ax
.
axhline
(
y
=
0
,
linewidth
=
0.5
,
color
=
"0.5"
,
linestyle
=
"dashed"
)
ax
.
axvline
(
x
=
0
,
linewidth
=
0.5
,
color
=
"0.5"
,
linestyle
=
"dashed"
)
# Set axis limits
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment