MCPcopy
hub / github.com/tum-pbs/PhiFlow / plot

Method plot

phi/vis/_matplotlib/_matplotlib_plots.py:475–485  ·  view source on GitHub ↗
(self, data: Field, figure, subplot, space: Box, min_val: float, max_val: float, show_color_bar: bool, color: Tensor, alpha: Tensor, err: Tensor)

Source from the content-addressed store, hash-verified

473 return data.spatial_rank == 3 and 'vector' in channel(data)
474
475 def plot(self, data: Field, figure, subplot, space: Box, min_val: float, max_val: float, show_color_bar: bool, color: Tensor, alpha: Tensor, err: Tensor):
476 dims = space.vector.item_names
477 vector = data.geometry.shape['vector']
478 x, y, z = reshaped_numpy(data.center[dims], [vector, data.shape.without('vector')])
479 u, v, w = reshaped_numpy(data.values[dims], [vector, data.shape.without('vector')])
480 if color.shape:
481 col = [_plt_col(c) for c in color.numpy(data.shape.non_channel).reshape(-1)]
482 else:
483 col = _plt_col(color)
484 alphas = reshaped_numpy(alpha, [data.shape.without('vector')])
485 subplot.quiver(x, y, z, u, v, w, color=col, alpha=alphas)
486
487
488class StreamPlot2D(Recipe):

Callers

nothing calls this directly

Calls 3

_plt_colFunction · 0.85
withoutMethod · 0.80
numpyMethod · 0.80

Tested by

no test coverage detected