(self, data: Field, figure, subplot, space: Box, min_val: float, max_val: float, show_color_bar: bool, color: Tensor, alpha: Tensor, err: Tensor)
| 446 | return data.spatial_rank == 2 and 'vector' in channel(data) |
| 447 | |
| 448 | 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): |
| 449 | dims = space.vector.item_names |
| 450 | vector = data.geometry.shape['vector'] |
| 451 | channels = channel(data).without('vector') |
| 452 | data = only_stored_elements(data) |
| 453 | for idx in channels.meshgrid(names=True): |
| 454 | c_data = data[idx] |
| 455 | x, y = reshaped_numpy(c_data.center[dims], [vector, c_data.shape.without('vector')]) |
| 456 | u, v = reshaped_numpy(c_data.values.vector[dims], [vector, c_data.shape.without('vector')]) |
| 457 | color_i = color[idx] |
| 458 | if wrap(color[idx] == 'cmap').all: |
| 459 | col = _next_line_color(subplot, kind='collections') # ToDo |
| 460 | elif color[idx].shape: |
| 461 | col = [_plt_col(c) for c in color_i.numpy(c_data.shape.non_channel).reshape(-1)] |
| 462 | else: |
| 463 | col = _plt_col(color[idx]) |
| 464 | alphas = reshaped_numpy(alpha, [c_data.shape.without('vector')]) |
| 465 | subplot.quiver(x, y, u, v, color=col, units='xy', scale=1, alpha=alphas, label=index_label(idx) if channels.volume > 1 else None) |
| 466 | if channels and not has_legend_like([index_label(idx_n) for idx_n in channels.meshgrid(names=True)], figure): |
| 467 | subplot.legend() |
| 468 | |
| 469 | |
| 470 | class VectorCloud3D(Recipe): |
nothing calls this directly
no test coverage detected