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

Method plot

phi/vis/_dash/_plotly_plots.py:233–243  ·  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

231 return data.spatial_rank == 2 and data.is_grid and 'vector' not in data.shape
232
233 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):
234 row, col = subplot
235 dims = spatial(data)
236 values = real_values(data).numpy(dims.reversed)
237 x = data.points.vector[dims[0].name].dimension(dims[1].name)[0].numpy()
238 y = data.points.vector[dims[1].name].dimension(dims[0].name)[0].numpy()
239 min_val, max_val = numpy.nanmin(values), numpy.nanmax(values)
240 min_val, max_val = min_val if numpy.isfinite(min_val) else 0, max_val if numpy.isfinite(max_val) else 0
241 color_scale = get_div_map(min_val, max_val, equal_scale=True)
242 # color_bar = graph_objects.heatmap.ColorBar(x=1.15) , colorbar=color_bar
243 figure.add_heatmap(row=row, col=col, x=x, y=y, z=values, zauto=False, zmin=min_val, zmax=max_val, colorscale=color_scale, showscale=show_color_bar)
244
245
246class VectorField2D(Recipe):

Callers

nothing calls this directly

Calls 4

real_valuesFunction · 0.85
get_div_mapFunction · 0.85
numpyMethod · 0.80
dimensionMethod · 0.80

Tested by

no test coverage detected