Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.measure
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.measure
Commits
becaea8e
Commit
becaea8e
authored
Apr 16, 2020
by
Alex UNNERVIK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used shared x-axis to fix the automatic scaling of x-axis across diagrams of the same system
parent
5850b304
Pipeline
#38976
passed with stage
in 5 minutes and 10 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
21 deletions
+15
-21
bob/measure/script/figure.py
bob/measure/script/figure.py
+15
-21
No files found.
bob/measure/script/figure.py
View file @
becaea8e
...
...
@@ -882,12 +882,15 @@ class GridSubplot(PlotBase):
figure
=
mpl
.
gcf
(),
)
def
create_subplot
(
self
,
n
):
def
create_subplot
(
self
,
n
,
shared_axis
=
None
):
i
,
j
=
numpy
.
unravel_index
(
n
,
(
self
.
_nrows
,
self
.
_ncols
))
i1
=
i
*
self
.
_row_times
+
self
.
_grid_axis_offset
i2
=
(
i
+
1
)
*
self
.
_row_times
+
self
.
_grid_axis_offset
j1
,
j2
=
j
*
self
.
_col_times
,
(
j
+
1
)
*
self
.
_col_times
axis
=
mpl
.
gcf
().
add_subplot
(
self
.
_gs
[
i1
:
i2
,
j1
:
j2
])
if
shared_axis
is
not
None
:
axis
=
mpl
.
gcf
().
add_subplot
(
self
.
_gs
[
i1
:
i2
,
j1
:
j2
],
sharex
=
shared_axis
)
else
:
axis
=
mpl
.
gcf
().
add_subplot
(
self
.
_gs
[
i1
:
i2
,
j1
:
j2
])
return
axis
def
finalize_one_page
(
self
):
...
...
@@ -958,17 +961,6 @@ class Hist(GridSubplot):
idx
,
input_scores
,
input_names
)
if
dev_neg
and
dev_pos
and
eval_neg
and
eval_pos
is
not
None
:
xmin
=
min
(
numpy
.
min
(
dev_neg
[
0
]),
numpy
.
min
(
eval_neg
[
0
]),
numpy
.
min
(
dev_pos
[
0
]),
numpy
.
min
(
eval_pos
[
0
]))
xmax
=
max
(
numpy
.
max
(
dev_neg
[
0
]),
numpy
.
max
(
eval_neg
[
0
]),
numpy
.
max
(
dev_pos
[
0
]),
numpy
.
max
(
eval_pos
[
0
]))
elif
dev_neg
and
dev_pos
is
not
None
:
xmin
=
min
(
numpy
.
min
(
dev_neg
[
0
]),
numpy
.
min
(
dev_pos
[
0
]))
xmax
=
max
(
numpy
.
max
(
dev_neg
[
0
]),
numpy
.
max
(
dev_pos
[
0
]))
elif
eval_neg
and
eval_pos
is
not
None
:
# Providing EVAL set results only not currently supported by bob bio hist, but potentially in the future?
xmin
=
min
(
numpy
.
min
(
eval_neg
[
0
]),
numpy
.
min
(
eval_pos
[
0
]))
xmax
=
max
(
numpy
.
max
(
eval_neg
[
0
]),
numpy
.
max
(
eval_pos
[
0
]))
# keep id of the current system
sys
=
idx
# if the id of the current system does not match the id of the plot,
...
...
@@ -978,23 +970,26 @@ class Hist(GridSubplot):
col
=
idx
%
self
.
_ncols
idx
=
col
+
self
.
_ncols
*
row
dev_axis
=
None
if
not
self
.
_hide_dev
or
not
self
.
_eval
:
self
.
_print_subplot
(
idx
,
sys
,
dev_neg
,
dev_pos
,
threshold
,
not
self
.
_no_line
,
False
,
xlim
=
(
xmin
,
xmax
)
dev_axis
=
self
.
_print_subplot
(
idx
,
sys
,
dev_neg
,
dev_pos
,
threshold
,
not
self
.
_no_line
,
False
,
)
if
self
.
_eval
:
idx
+=
self
.
_ncols
if
not
self
.
_hide_dev
else
0
self
.
_print_subplot
(
idx
,
sys
,
eval_neg
,
eval_pos
,
threshold
,
not
self
.
_no_line
,
True
,
xlim
=
(
xmin
,
xmax
)
)
idx
,
sys
,
eval_neg
,
eval_pos
,
threshold
,
not
self
.
_no_line
,
True
,
shared_axis
=
dev_axis
)
def
_print_subplot
(
self
,
idx
,
sys
,
neg
,
pos
,
threshold
,
draw_line
,
evaluation
,
xlim
=
None
):
def
_print_subplot
(
self
,
idx
,
sys
,
neg
,
pos
,
threshold
,
draw_line
,
evaluation
,
shared_axis
=
None
):
""" print a subplot for the given score and subplot index"""
n
=
idx
%
self
.
_step_print
col
=
n
%
self
.
_ncols
sub_plot_idx
=
n
+
1
axis
=
self
.
create_subplot
(
n
)
axis
=
self
.
create_subplot
(
n
,
shared_axis
)
self
.
_setup_hist
(
neg
,
pos
)
if
col
==
0
:
axis
.
set_ylabel
(
self
.
_y_label
)
...
...
@@ -1007,8 +1002,6 @@ class Hist(GridSubplot):
is_lower
=
evaluation
or
not
self
.
_eval
if
is_lower
and
sys_idx
+
self
.
_ncols
>=
min
(
sys_per_page
,
rest_print
):
axis
.
set_xlabel
(
self
.
_x_label
)
if
xlim
is
not
None
:
axis
.
set_xlim
(
xlim
)
dflt_title
=
"Eval. scores"
if
evaluation
else
"Dev. scores"
if
self
.
n_systems
==
1
and
(
not
self
.
_eval
or
self
.
_hide_dev
):
dflt_title
=
" "
...
...
@@ -1029,6 +1022,7 @@ class Hist(GridSubplot):
# to display, save figure
if
self
.
_step_print
==
sub_plot_idx
or
(
is_lower
and
sys
==
self
.
n_systems
-
1
):
self
.
finalize_one_page
()
return
axis
def
_get_title
(
self
,
idx
,
dflt
=
None
):
""" Get the histo title for the given idx"""
...
...
Write
Preview
Markdown
is supported
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