(self, data: Field, figure, subplot, space: Box, min_val: float, max_val: float, show_color_bar: bool, color: Tensor, alpha: Tensor, err: Tensor)
| 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 | |
| 246 | class VectorField2D(Recipe): |
nothing calls this directly
no test coverage detected