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
Connor Hainje
pidanalysis
Commits
a2f7da95
Commit
a2f7da95
authored
Dec 10, 2021
by
connor.hainje@pnnl.gov
Browse files
Continued plot refactor
parent
55f4079d
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
packages/pidplots/pidplots/contribution.py
View file @
a2f7da95
...
...
@@ -4,11 +4,11 @@ import matplotlib.pyplot as plt
from
.
import
const
,
colors
from
.
import
distributions
as
dist
from
.utils
import
(
_ax_xlabel
,
connected_region_borders
,
imshow_2D_axis_labels
,
outer_legend
,
better_xlabel
,
set_bin_by_xlabel
,
text_array_values
,
xticks_radians_to_degrees
,
)
...
...
@@ -119,7 +119,7 @@ def plot_avg_contribution_1D(df, bin_by="p", title=None, figsize=None, color_lis
fig
,
ax
=
plt
.
subplots
(
figsize
=
figsize
)
subplot_avg_contribution_1D
(
ax
,
df
,
bin_by
=
bin_by
,
color_list
=
color_list
)
fig
.
tight_layout
()
_ax
_xlabel
(
ax
,
bin_by
)
set_bin_by
_xlabel
(
ax
,
bin_by
)
if
bin_by
==
"theta"
:
xticks_radians_to_degrees
(
ax
)
ax
.
set_ylabel
(
"Average contribution value"
)
...
...
packages/pidplots/pidplots/eff_pur.py
View file @
a2f7da95
...
...
@@ -2,8 +2,8 @@ import numpy as np
import
matplotlib.pyplot
as
plt
from
.
import
const
,
colors
from
.utils
import
(
_ax_xlabel
,
better_xlabel
,
set_bin_by_xlabel
,
connected_region_borders
,
imshow_2D_axis_labels
,
outer_legend
,
...
...
@@ -137,7 +137,7 @@ def _plot_1D(subplot_fn, df, bin_by="p", figsize=None, ylabel=None, title=None):
fig
,
ax
=
plt
.
subplots
(
figsize
=
figsize
)
subplot_fn
(
ax
,
df
,
bin_by
=
bin_by
)
fig
.
tight_layout
()
_ax
_xlabel
(
ax
,
bin_by
)
set_bin_by
_xlabel
(
ax
,
bin_by
)
if
bin_by
==
"theta"
:
xticks_radians_to_degrees
(
ax
)
ax
.
set_ylabel
(
ylabel
)
...
...
packages/pidplots/pidplots/plot.py
View file @
a2f7da95
This diff is collapsed.
Click to expand it.
packages/pidplots/pidplots/utils.py
View file @
a2f7da95
...
...
@@ -187,7 +187,7 @@ def _validate_bin_by_1D(bin_by):
)
def
_xlabel_
bin_by
(
bin_by
):
def
bin_by
_label
(
bin_by
):
_validate_bin_by_1D
(
bin_by
)
if
bin_by
==
"p"
:
return
f
"$p$ [
{
const
.
P_BIN_UNIT
}
]"
...
...
@@ -195,14 +195,15 @@ def _xlabel_bin_by(bin_by):
return
f
"$
\\
theta$ [
{
const
.
THETA_BIN_UNIT
}
]"
def
_ax_xlabel
(
ax
,
bin_by
):
_validate_bin_by_1D
(
bin_by
)
ax
.
set_xlabel
(
_xlabel_bin_by
(
bin_by
))
def
set_bin_by_xlabel
(
obj
,
bin_by
):
from
matplotlib.figure
import
Figure
from
matplotlib.axes
import
Axes
def
_fig_xlabel
(
fig
,
bin_by
):
_validate_bin_by_1D
(
bin_by
)
better_xlabel
(
fig
,
_xlabel_bin_by
(
bin_by
),
fontsize
=
14
)
label
=
bin_by_label
(
bin_by
)
if
isinstance
(
obj
,
Figure
):
better_xlabel
(
obj
,
label
)
elif
isinstance
(
obj
,
Axes
):
obj
.
set_xlabel
(
label
)
def
imshow_2D_axis_labels
(
ax
):
...
...
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