(self, data: Field, figure, subplot, space: Box, min_val: float, max_val: float, show_color_bar: bool, color: Tensor, alpha: Tensor, err: Tensor)
| 249 | return data.spatial_rank == 2 and data.is_grid |
| 250 | |
| 251 | 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): |
| 252 | data = data.at_centers() |
| 253 | row, col = subplot |
| 254 | dims = data.elements.vector.item_names |
| 255 | vector = data.elements.shape['vector'] |
| 256 | extra_channels = data.shape.channel.without('vector') |
| 257 | x, y = math.reshaped_numpy(data.points.vector[dims], [vector, data.shape.non_channel]) |
| 258 | u, v = math.reshaped_numpy(data.values.vector[dims], [vector, extra_channels, data.shape.without(vector)]) |
| 259 | for ch in range(u.shape[0]): |
| 260 | # quiver = figure_factory.create_quiver(x, y, data_x[ch], data_y[ch], scale=1.0) # 7 points per arrow |
| 261 | # fig.add_trace(quiver, row=row, col=col) |
| 262 | u_ch = u[ch] |
| 263 | v_ch = v[ch] |
| 264 | # lines_y = numpy.stack([y, y + data_y_flat, [None] * len(x)], -1).flatten() # 3 points per arrow |
| 265 | # lines_x = numpy.stack([x, x + data_x_flat, [None] * len(x)], -1).flatten() |
| 266 | lines_x = numpy.stack([x, x + u_ch, [None] * len(x)], -1).flatten() |
| 267 | lines_y = numpy.stack([y, y + v_ch, [None] * len(x)], -1).flatten() # 3 points per arrow |
| 268 | name = extra_channels.item_names[0][ch] if extra_channels.rank == 1 and extra_channels.item_names[0] is not None else None |
| 269 | figure.add_scatter(x=lines_x, y=lines_y, mode='lines', row=row, col=col, name=name) |
| 270 | if u.shape[0] == 1: |
| 271 | figure.update_layout(showlegend=False) |
| 272 | |
| 273 | |
| 274 | class Heatmap3D(Recipe): |
nothing calls this directly
no test coverage detected