Commit db7cbf58 authored by connor.hainje@pnnl.gov's avatar connor.hainje@pnnl.gov
Browse files

Add fontsize as kwarg

parent 2db99c3e
......@@ -112,7 +112,9 @@ def _disable_subplot_legends_and_labels(subplot_kw):
return subplot_kw
def add_p_theta_fig_labels(fig, axs, xlabel=None, ylabel=None):
def add_p_theta_fig_labels(
fig, axs, xlabel=None, ylabel=None, bin_fontsize=14, label_fontsize=16
):
x_pos = 0.0
for i, p in enumerate(const.P_BIN_LABELS):
if i == 0:
......@@ -123,7 +125,7 @@ def add_p_theta_fig_labels(fig, axs, xlabel=None, ylabel=None):
y_lo = axs[i, 0].get_position().ymax
y_hi = axs[i - 1, 0].get_position().ymin
y_pos = 0.5 * (y_lo + y_hi)
fig.text(x_pos, y_pos, p, ha="right", va="center", fontsize=20)
fig.text(x_pos, y_pos, p, ha="right", va="center", fontsize=bin_fontsize)
y_pos = 0.0
for j, theta in enumerate(const.THETA_BIN_LABELS):
......@@ -135,14 +137,18 @@ def add_p_theta_fig_labels(fig, axs, xlabel=None, ylabel=None):
x_lo = axs[-1, j - 1].get_position().xmax
x_hi = axs[-1, j].get_position().xmin
x_pos = 0.5 * (x_lo + x_hi)
fig.text(x_pos, y_pos, theta, ha="center", va="top", fontsize=20)
fig.text(x_pos, y_pos, theta, ha="center", va="top", fontsize=bin_fontsize)
L = r"$\longleftarrow$"
R = r"$\longrightarrow$"
tlabel = f"{L} $\\theta$ [{const.THETA_BIN_UNIT}] {R}"
plabel = f"{L} $p$ [{const.P_BIN_UNIT}] {R}"
better_xlabel(fig, tlabel if xlabel is None else xlabel, fontsize=20, y=-0.06)
better_ylabel(fig, plabel if ylabel is None else ylabel, fontsize=20, x=-0.15)
better_xlabel(
fig, tlabel if xlabel is None else xlabel, fontsize=label_fontsize, y=-0.05
)
better_ylabel(
fig, plabel if ylabel is None else ylabel, fontsize=label_fontsize, x=-0.05
)
def add_detector_particle_labels(fig, axs, fontsize=20):
......@@ -610,14 +616,16 @@ def plot_blame_numbers(df, frac=False, radar=False, figsize=(7, 6)):
def subplot_blame(ax, df, color_list=None, celltextsize=10):
color_list = colors.fill_color_list(color_list, detectors=True)
cmap = colors.make_colormap(color_list)
cmap.set_bad(color="white")
blame, freq = compute_blame_in_all_bins(df)
ax.imshow(blame, cmap=cmap, vmin=0, vmax=len(const.DETECTORS))
add_p_theta_axis_labels(ax)
kwargs = dict(ha="center", va="center", fontsize=celltextsize)
for i in range(const.N_P_BINS):
for j in range(const.N_THETA_BINS):
label = f"{const.DETECTORS[blame[i,j]]}\n{freq[i,j]*100:.0f}%"
ax.text(j, i, label, **kwargs)
text_array_values(ax, freq, fontsize=celltextsize)
# kwargs = dict(ha="center", va="center", fontsize=celltextsize)
# for i in range(const.N_P_BINS):
# for j in range(const.N_THETA_BINS):
# label = f"{const.DETECTORS[blame[i,j]]}\n{freq[i,j]*100:.0f}%"
# ax.text(j, i, label, **kwargs)
def plot_blame(df, figsize=(7, 6)):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment