Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ax[j, i].tick_params(labelsize=xt_labelsize)
ax[j, i].set_title(
"{} - {}".format(models[i], models[j + 1]), fontsize=titlesize, wrap=True
)
if xlabels:
set_xticklabels(ax[-1, -1], coord_labels)
fig.autofmt_xdate()
fig.tight_layout()
if legend:
ncols = len(handles) // 6 + 1
ax[0, 1].legend(
handles=handles, ncol=ncols, title=color, bbox_to_anchor=(0, 1), loc="upper left"
)
if backend_show(show):
plt.show()
return ax
r"Value $\pm$ MCSE for quantiles" if errorbar else "MCSE for quantiles",
fontsize=ax_labelsize,
wrap=True,
)
ax_.set_xlim(0, 1)
if rug:
ax_.yaxis.get_major_locator().set_params(nbins="auto", steps=[1, 2, 5, 10])
y_min, y_max = ax_.get_ylim()
yticks = ax_.get_yticks()
yticks = yticks[(yticks >= y_min) & (yticks < y_max)]
ax_.set_yticks(yticks)
ax_.set_yticklabels(["{:.3g}".format(ytick) for ytick in yticks])
elif not errorbar:
ax_.set_ylim(bottom=0)
if backend_show(show):
plt.show()
return ax
ax_i.set_yticks([])
if var_name != pp_var_name:
xlabel = "{} / {}".format(var_name, pp_var_name)
else:
xlabel = var_name
ax_i.set_xlabel(make_label(xlabel, selection), fontsize=ax_labelsize)
if legend:
if i == 0:
ax_i.legend(fontsize=xt_labelsize * 0.75)
else:
ax_i.legend([])
if backend_show(show):
plt.show()
if animated:
ani = animation.FuncAnimation(
fig, animate, np.arange(0, num_pp_samples), init_func=init, **animation_kwargs
)
return axes, ani
else:
return axes
axjoin.scatter(x, y, **joint_kwargs)
elif kind == "kde":
plot_kde(x, y, contour=contour, fill_last=fill_last, ax=axjoin, **joint_kwargs)
else:
if gridsize == "auto":
gridsize = int(len(x) ** 0.35)
axjoin.hexbin(x, y, mincnt=1, gridsize=gridsize, **joint_kwargs)
axjoin.grid(False)
for val, ax_, rotate in ((x, ax_hist_x, False), (y, ax_hist_y, True)):
plot_dist(val, textsize=xt_labelsize, rotated=rotate, ax=ax_, **marginal_kwargs)
ax_hist_x.set_xlim(axjoin.get_xlim())
ax_hist_y.set_ylim(axjoin.get_ylim())
if backend_show(show):
plt.show()
return np.array([axjoin, ax_hist_x, ax_hist_y])
legend=legend,
fill_last=fill_last,
textsize=textsize,
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="matplotlib",
backend_kwargs=backend_kwargs,
show=show,
)
if backend_show(show):
plt.show()
return ax
if loc in ["left", "right"]:
spine.set_visible(False)
if len(plot_handler.data) > 1:
plot_handler.make_bands(ax_)
labels, ticks = plot_handler.labels_and_ticks()
axes[0].set_yticks(ticks)
axes[0].set_yticklabels(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].set_ylim(-all_plotters[0].group_offset, y_max)
if backend_show(show):
plt.show()
return axes
if use_hpd:
plot_hpd(x_vals, unif_densities, **hpd_kwargs)
else:
for idx in range(n_unif):
unif_density, _, _ = _fast_kde(unif[idx, :], xmin=0, xmax=1)
ax.plot(x_vals, unif_density, **plot_unif_kwargs)
ax.plot(x_vals, loo_pit_kde, **plot_kwargs)
ax.tick_params(labelsize=xt_labelsize)
if legend:
if not (use_hpd or (ecdf and ecdf_fill)):
label = "{:.3g}% credible interval".format(credible_interval) if ecdf else "Uniform"
ax.plot([], label=label, **plot_unif_kwargs)
ax.legend()
if backend_show(show):
plt.show()
return ax
g_s = complex(gridsize[0])
x_x, y_y = np.mgrid[xmin:xmax:g_s, ymin:ymax:g_s]
ax.grid(False)
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin, ymax)
if contour:
qcfs = ax.contourf(x_x, y_y, density, antialiased=True, **contourf_kwargs)
qcs = ax.contour(x_x, y_y, density, **contour_kwargs)
if not fill_last:
qcfs.collections[0].set_alpha(0)
qcs.collections[0].set_alpha(0)
else:
ax.pcolormesh(x_x, y_y, density, **pcolormesh_kwargs)
if backend_show(show):
plt.show()
return ax
for idx, counts in enumerate(all_counts):
ax.plot(bin_ary, counts, "o", color=colors[idx])
ax.vlines(bin_ary, ymin, counts, lw=2, color=colors[idx])
ax.set_ylim(0, all_counts.mean() * 2)
if ref_line:
ax.axhline(y=all_counts.mean(), linestyle="--", color="k")
if labels:
ax.set_xlabel("Rank (all chains)", fontsize=ax_labelsize)
ax.set_yticks(y_ticks)
ax.set_yticklabels(np.arange(len(y_ticks)))
ax.set_title(make_label(var_name, selection), fontsize=titlesize)
else:
ax.set_yticks([])
if backend_show(show):
plt.show()
return axes
axes[idx, 1].hlines(
line_values, *xlims[1], colors="black", linewidth=1.5, alpha=trace_kwargs["alpha"]
)
axes[idx, 0].set_ylim(bottom=0, top=ylims[0][1])
axes[idx, 1].set_xlim(left=data.draw.min(), right=data.draw.max())
axes[idx, 1].set_ylim(*ylims[1])
if legend:
handles = [
Line2D([], [], color=color, label=chain_id)
for chain_id, color in zip(data.chain.values, colors)
]
if combined:
handles.insert(0, Line2D([], [], color=colors[-1], label="combined"))
axes[0, 1].legend(handles=handles, title="chain")
if backend_show(show):
plt.show()
return axes