Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Connor Hainje
pidanalysis
Commits
ff80b957
Commit
ff80b957
authored
Dec 13, 2021
by
connor.hainje@pnnl.gov
Browse files
Update to use new set_bin_by_xlabel method
parent
a2f7da95
Changes
1
Hide whitespace changes
Inline
Side-by-side
packages/pidplots/pidplots/binary.py
View file @
ff80b957
...
...
@@ -8,8 +8,7 @@ from .utils import (
better_ylabel
,
outer_legend
,
_validate_bin_by_1D
,
_ax_xlabel
,
_fig_xlabel
,
set_bin_by_xlabel
,
)
from
.data
import
make_detector_dataframes
...
...
@@ -140,7 +139,7 @@ def subplot_efficiency(ax, df, part, threshold=0.5, bin_by="p"):
def
plot_efficiency
(
df
,
part
,
threshold
=
0.5
,
bin_by
=
"p"
):
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
7
,
5
))
subplot_efficiency
(
ax
,
df
,
part
,
threshold
=
threshold
,
bin_by
=
bin_by
)
_ax
_xlabel
(
ax
,
bin_by
)
set_bin_by
_xlabel
(
ax
,
bin_by
)
fig
.
tight_layout
()
return
fig
...
...
@@ -170,7 +169,7 @@ def plot_efficiency_by_detector(df, part, threshold=0.5, bin_by="p", no_SVD=Fals
ax
.
set_title
(
det
,
fontsize
=
14
)
fig
.
tight_layout
()
_fig
_xlabel
(
fig
,
bin_by
)
set_bin_by
_xlabel
(
fig
,
bin_by
)
return
fig
...
...
@@ -195,7 +194,7 @@ def subplot_purity(ax, df, part, threshold=0.5, bin_by="p", color=None, ls="-"):
def
plot_purity
(
df
,
part
,
threshold
=
0.5
,
bin_by
=
"p"
):
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
7
,
5
))
subplot_purity
(
ax
,
df
,
part
,
threshold
=
threshold
,
bin_by
=
bin_by
)
_ax
_xlabel
(
ax
,
bin_by
)
set_bin_by
_xlabel
(
ax
,
bin_by
)
fig
.
tight_layout
()
return
fig
...
...
@@ -225,7 +224,7 @@ def plot_purity_varying_threshold(
subplot_purity
(
ax
,
df
,
part
,
threshold
=
0.5
,
bin_by
=
bin_by
,
color
=
"k"
,
ls
=
"--"
)
ax
.
set_ylim
(
ylim
)
_ax
_xlabel
(
ax
,
bin_by
)
set_bin_by
_xlabel
(
ax
,
bin_by
)
ax
.
set_ylabel
(
"Purity"
,
fontsize
=
14
)
fig
.
tight_layout
()
...
...
@@ -261,7 +260,7 @@ def subplot_contribution(ax, df, ls="-", bin_by="p", color_list=None):
def
plot_contribution
(
df
,
bin_by
=
"p"
,
color_list
=
None
):
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
7
,
5
))
subplot_contribution
(
ax
,
df
,
bin_by
=
bin_by
,
color_list
=
color_list
)
_ax
_xlabel
(
ax
,
bin_by
)
set_bin_by
_xlabel
(
ax
,
bin_by
)
ax
.
set_ylabel
(
"Average contribution"
)
fig
.
tight_layout
()
outer_legend
(
fig
,
const
.
DETECTORS
,
loc
=
"top"
,
fontsize
=
12
,
ncol
=
3
)
...
...
@@ -289,7 +288,7 @@ def plot_contribution_by_correctness(df, part, title=None, bin_by="p", color_lis
axs
[
1
].
set_title
(
"Incorrect ensemble binary PID"
)
fig
.
tight_layout
()
_fig
_xlabel
(
fig
,
bin_by
)
set_bin_by
_xlabel
(
fig
,
bin_by
)
better_ylabel
(
fig
,
"Average contribution"
)
outer_legend
(
fig
,
const
.
DETECTORS
,
loc
=
"top"
,
fontsize
=
12
,
y
=
0.98
)
...
...
@@ -386,7 +385,7 @@ def subplot_blame(
def
plot_blame
(
df
,
bin_by
=
"p"
,
color_list
=
None
):
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
7
,
6
))
subplot_blame
(
ax
,
df
,
bin_by
=
bin_by
,
color_list
=
color_list
)
_ax
_xlabel
(
ax
,
bin_by
)
set_bin_by
_xlabel
(
ax
,
bin_by
)
ax
.
set_ylabel
(
"Blame"
)
fig
.
tight_layout
()
ax
.
legend
(
...
...
@@ -419,7 +418,7 @@ def plot_blame_by_correctness(df, part, title=None, bin_by="p", color_list=None)
axs
[
1
].
set_title
(
"Incorrect ensemble binary PID"
)
fig
.
tight_layout
()
_fig
_xlabel
(
fig
,
bin_by
)
set_bin_by
_xlabel
(
fig
,
bin_by
)
better_ylabel
(
fig
,
"Blame"
)
axs
[
1
].
legend
(
...
...
@@ -545,5 +544,5 @@ def plot_hypothesis_breakdown_by_detector(df, true, pred, bin_by="p", color_list
ncol
=
6
,
)
_fig
_xlabel
(
fig
,
bin_by
)
set_bin_by
_xlabel
(
fig
,
bin_by
)
return
fig
Write
Preview
Supports
Markdown
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