Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
quiver_kwargs.update({arg: kwargs[arg]})
else:
scatter_kwargs.update({arg: kwargs[arg]})
ax.quiver(
X_grid[:, 0], X_grid[:, 1], V_grid[:, 0], V_grid[:, 1], **quiver_kwargs
)
if principal_curve:
curve = adata.uns["principal_curve"]["projections"]
pl.plot(curve[:, 0], curve[:, 1], c="w", lw=6, zorder=4)
pl.plot(curve[:, 0], curve[:, 1], c="k", lw=3, zorder=5)
size = 4 * default_size(adata) if size is None else size
ax = scatter(
adata,
layer=layer,
color=color,
size=size,
title=title,
ax=ax,
zorder=0,
**scatter_kwargs,
)
savefig_or_show(dpi=dpi, save=save, show=show)
if show is False:
return ax
kwargs["frameon"] = paga_kwargs["frameon"]
if title is None:
title = (
f"paga ({paga_groups})"
if transitions is None
else f"paga velocity-graph ({paga_groups})"
)
paga_kwargs["title"] = title
ax = pl.figure(None, figsize, dpi=dpi).gca() if ax is None else ax
if scatter_flag and basis is not None:
if "alpha" not in kwargs:
kwargs["alpha"] = 0.5
kwargs.update(dict(basis=basis, layer=layer, color=paga_groups, size=size))
kwargs.update(dict(vkey=vkey, title=title, ax=ax, show=False, save=None))
ax = scatter(adata, x=x, y=y, zorder=0, **kwargs)
text_kwds = {"zorder": 1000, "alpha": legend_loc == "on data"}
_paga(adata, ax=ax, show=False, text_kwds=text_kwds, **paga_kwargs)
savefig_or_show(dpi=dpi, save=save, show=show)
if show is False:
return ax
quiver3d_kwargs = {"zorder": 3, "linewidth": 0.5, "arrow_length_ratio": 0.3}
c = list(c) + [element for element in list(c) for _ in range(2)]
if is_color_like(c[0]):
ax.quiver(x0, x1, x2, v0, v1, v2, color=c, **quiver3d_kwargs)
else:
ax.quiver(x0, x1, x2, v0, v1, v2, c, **quiver3d_kwargs)
else:
quiver_kwargs.update({"zorder": 3})
if is_color_like(c[0]):
ax.quiver(X[:, 0], X[:, 1], V[:, 0], V[:, 1], color=c, **quiver_kwargs)
else:
ax.quiver(X[:, 0], X[:, 1], V[:, 0], V[:, 1], c, **quiver_kwargs)
scatter_kwargs.update({"basis": basis, "x": x, "y": y, "color": color})
scatter_kwargs.update({"vkey": vkey, "layer": layer})
ax = scatter(adata, size=size, title=title, ax=ax, zorder=0, **scatter_kwargs)
savefig_or_show(dpi=dpi, save=save, show=show)
if show is False:
return ax
stream_kwargs = {
"linewidth": linewidth,
"density": 2 * density,
"zorder": 3,
"color": "k" if arrow_color is None else arrow_color,
}
for arg in list(kwargs):
if arg in stream_kwargs:
stream_kwargs.update({arg: kwargs[arg]})
else:
scatter_kwargs.update({arg: kwargs[arg]})
ax.streamplot(X_grid[0], X_grid[1], V_grid[0], V_grid[1], **stream_kwargs)
size = 8 * default_size(adata) if size is None else size
ax = scatter(
adata,
layer=layer,
color=color,
size=size,
title=title,
ax=ax,
zorder=0,
**scatter_kwargs,
)
savefig_or_show(dpi=dpi, save=save, show=show)
if show is False:
return ax
if mode == "stochastic":
ss, us = second_order_moments(_adata)
s, u, ss, us = s.flatten(), u.flatten(), ss.flatten(), us.flatten()
fit = stochastic_fits[0]
ax = pl.subplot(gs[v * nplts + len(layers) + 1])
beta, offset = 1, 0
if f"{fit}_beta" in adata.var.keys():
beta = _adata.var[f"{fit}_beta"]
if f"{fit}_offset" in adata.var.keys():
offset = _adata.var[f"{fit}_offset"]
x = np.array(2 * (ss - s ** 2) - s)
y = np.array(2 * (us - u * s) + u + 2 * s * offset / beta)
kwargs["xlabel"] = r"2 $\Sigma_s - \langle s \rangle$"
kwargs["ylabel"] = r"2 $\Sigma_{us} + \langle u \rangle$"
scatter(
adata,
x=x,
y=y,
color=color,
title=var,
frameon=True,
ax=ax,
save=False,
show=False,
**scatter_kwargs,
**kwargs,
)
xnew = np.linspace(np.min(x), np.max(x) * 1.02)
for fit in stochastic_fits:
gamma, beta, offset2 = 1, 1, 0
)
scatter_kwargs.update({"alpha": 0, "color": groups_key})
x, y = pos[:, 0], pos[:, 1]
if plot:
axs_pars = setup_axes(ax=ax, panels=colors, colorbars=colorbars)
axs, panel_pos, draw_region_width, _ = axs_pars
if len(colors) == 1 and not isinstance(axs, list):
axs = [axs]
for icolor, c in enumerate(colors):
if title[icolor] is not None:
axs[icolor].set_title(title[icolor])
axs[icolor] = scatter(
adata,
x=x,
y=y,
title=title[icolor],
ax=axs[icolor],
save=None,
zorder=0,
show=False,
**scatter_kwargs,
)
sct = _paga_graph(
adata,
axs[icolor],
colors=c,
solid_edges=solid_edges,
dashed_edges=dashed_edges,