Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
axes[0, 0].yaxis.ticker = FixedTicker(ticks=ticks)
axes[0, 0].yaxis.major_label_overrides = dict(zip(map(str, ticks), map(str, labels)))
all_plotters = list(plot_handler.plotters.values())
y_max = plot_handler.y_max() - all_plotters[-1].group_offset
if kind == "ridgeplot": # space at the top
y_max += ridgeplot_overlap
axes[0, 0].y_range._property_values[
"start"
] = -all_plotters[ # pylint: disable=protected-access
0
].group_offset
axes[0, 0].y_range._property_values["end"] = y_max # pylint: disable=protected-access
if backend_show(show):
grid = gridplot(axes.tolist(), toolbar_location="above")
bkp.show(grid)
return axes
ax.xaxis.major_label_overrides = dict(
zip(map(str, y_ticks), map(str, range(len(y_ticks))))
)
else:
ax.yaxis.major_tick_line_color = None
ax.yaxis.minor_tick_line_color = None
ax.xaxis.major_label_text_font_size = "0pt"
ax.yaxis.major_label_text_font_size = "0pt"
_title = Title()
_title.text = make_label(var_name, selection)
ax.title = _title
if backend_show(show):
grid = gridplot(axes.tolist(), toolbar_location="above")
bkp.show(grid)
return axes
per = np.percentile(val, [25, 75, 50])
hpd_intervals = hpd(val, credible_interval, multimodal=False)
if quartiles:
ax_.line([0, 0], per[:2], line_width=linewidth * 3, line_color="black")
ax_.line([0, 0], hpd_intervals, line_width=linewidth, line_color="black")
ax_.circle(0, per[-1])
_title = Title()
_title.text = make_label(var_name, selection)
ax_.title = _title
ax_.xaxis.major_tick_line_color = None
ax_.xaxis.minor_tick_line_color = None
ax_.xaxis.major_label_text_font_size = "0pt"
if backend_show(show):
grid = gridplot(ax.tolist(), toolbar_location="above")
bkp.show(grid)
return ax
fill_last=fill_last,
plot_kwargs=plot_kwargs,
fill_kwargs=fill_kwargs,
rug_kwargs=rug_kwargs,
contour_kwargs=contour_kwargs,
contourf_kwargs=contourf_kwargs,
pcolormesh_kwargs=pcolormesh_kwargs,
ax=ax,
backend="bokeh",
backend_kwargs={},
show=False,
)
else:
raise TypeError('Invalid "kind":{}. Select from {{"auto","kde","hist"}}'.format(kind))
if backend_show(show):
bkp.show(ax, toolbar_location="above")
return ax
x_non_div = [list(range(len(non_div[0]))) for _ in range(len(non_div))]
ax.multi_line(
x_non_div, non_div, line_color="black", line_alpha=0.05,
)
if np.any(diverging_mask):
div = list(_posterior[:, diverging_mask].T)
x_non_div = [list(range(len(div[0]))) for _ in range(len(div))]
ax.multi_line(x_non_div, div, color="lime", line_width=1, line_alpha=0.5)
ax.xaxis.ticker = FixedTicker(ticks=list(range(len(var_names))))
ax.xaxis.major_label_overrides = dict(zip(map(str, range(len(var_names))), map(str, var_names)))
ax.xaxis.major_label_orientation = np.pi / 2
if backend_show(show):
bkp.show(ax)
return ax
for chain, chain_divs in enumerate(divs):
div_idxs = np.arange(len(chain_divs))[chain_divs]
if div_idxs.size > 0:
values = value[chain, div_idxs]
tmp_cds = ColumnDataSource({"y": values, "x": div_idxs})
if divergences == "top":
y_div_trace = value.max()
else:
y_div_trace = value.min()
glyph_density = Dash(x="y", y=0.0, **div_density_kwargs)
glyph_trace = Dash(x="x", y=y_div_trace, **div_trace_kwargs)
axes[idx, 0].add_glyph(tmp_cds, glyph_density)
axes[idx, 1].add_glyph(tmp_cds, glyph_trace)
if backend_show(show):
grid = gridplot(axes.tolist(), toolbar_location="above")
bkp.show(grid)
return axes
x=[(n_data_points - 1 + xmax) / 2],
y=[np.mean(bin_edges[idx : idx + 2])],
text=[bin_format.format(count, count / n_data_points * 100)],
)
ax.x_range._property_values["end"] = xmax + 1 # pylint: disable=protected-access
ax.xaxis.axis_label = "Data Point"
ax.yaxis.axis_label = "Shape parameter k"
if ymin > 0:
ax.y_range._property_values["start"] = -0.02 # pylint: disable=protected-access
if ymax < 1:
ax.y_range._property_values["end"] = 1.02 # pylint: disable=protected-access
elif ymax > 1 & annotate:
ax.y_range._property_values["end"] = 1.1 * ymax # pylint: disable=protected-access
if backend_show(show):
bkp.show(ax, toolbar_location="above")
return ax
kind=kind,
point_estimate=point_estimate,
round_to=round_to,
credible_interval=credible_interval,
multimodal=multimodal,
ref_val=ref_val,
rope=rope,
ax_labelsize=ax_labelsize,
**kwargs
)
idx += 1
_title = Title()
_title.text = make_label(var_name, selection)
ax_.title = _title
if backend_show(show):
grid = gridplot(ax.tolist(), toolbar_location="above")
bkp.show(grid)
return ax
ax_.add_glyph(cds_rug, glyph)
title = Title()
title.text = make_label(var_name, selection)
ax_.title = title
ax_.xaxis.axis_label = "Quantile"
ax_.yaxis.axis_label = (
r"Value $\pm$ MCSE for quantiles" if errorbar else "MCSE for quantiles"
)
if not errorbar:
ax_.y_range._property_values["start"] = -0.05 # pylint: disable=protected-access
ax_.y_range._property_values["end"] = 1 # pylint: disable=protected-access
if backend_show(show):
grid = gridplot(ax.tolist(), toolbar_location="above")
bkp.show(grid)
return ax
colors = [rgb2hex(item) for item in cmap(np.linspace(0, 1, 256))]
else:
colors = cmap
ax.image(
image=[density.T],
x=xmin,
y=ymin,
dw=(xmax - xmin) / density.shape[0],
dh=(ymax - ymin) / density.shape[1],
palette=colors,
**pcolormesh_kwargs
)
ax.x_range.range_padding = ax.y_range.range_padding = 0
if backend_show(show):
bkp.show(ax, toolbar_location="above")
return ax