Skip to content

Commit

Permalink
[vis] Plot Point as circle
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed May 17, 2024
1 parent 92f320a commit b1ca7d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions phi/vis/_dash/_plotly_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def plot(self, data: Field, figure, subplot, space: Box, min_val: float, max_val
figure.add_shape(type="path", xref="x", yref="y", path=path, fillcolor=ci, line_width=.5, line_color='#FFFFFF')
else:
if isinstance(data.elements, Point):
symbol = 'x'
symbol = None
marker_size = 12 / (subplot_height / (yrange[1] - yrange[0]))
else:
symbol = 'asterisk'
Expand Down Expand Up @@ -286,7 +286,7 @@ def plot(self, data: Field, figure, subplot, space: Box, min_val: float, max_val
symbol = 'square'
marker_size = math.mean(data.elements.bounding_half_extent(), 'vector').numpy() * 1
elif isinstance(data.elements, Point):
symbol = 'x'
symbol = None
marker_size = 4 / (size[1] * (domain_y[1] - domain_y[0]) / (yrange[1] - yrange[0]) * 0.5)
else:
symbol = 'asterisk'
Expand Down
4 changes: 2 additions & 2 deletions phi/vis/_matplotlib/_matplotlib_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def _plot_points(axis: Axes, data: Field, dims: tuple, vector: Shape, color: Ten
alphas = reshaped_numpy(alpha, [non_channel(data)])
if isinstance(data.geometry, Point):
if spatial(data.points).is_empty:
axis.scatter(x, y, marker='x', color=mpl_colors, s=6 ** 2, alpha=alphas)
axis.scatter(x, y, color=mpl_colors, s=6 ** 2, alpha=alphas)
if (err != 0).any:
x_err = reshaped_numpy(err.vector[dims[0]], [instance(data)]) if dims[0] in err.vector.item_names else 0
y_err = reshaped_numpy(err.vector[dims[1]], [instance(data)]) if dims[1] in err.vector.item_names else 0
Expand Down Expand Up @@ -796,7 +796,7 @@ def plot(self, data: Field, figure, subplot, space: Box, min_val: float, max_val
elif isinstance(data.geometry, Point):
if not spatial(data.geometry):
size = 6 / (0.5 * (x_scale+y_scale+z_scale)/3)
subplot.scatter(x, y, z, marker='x', color=mpl_colors, alpha=alphas, s=(size * 0.5 * (x_scale + y_scale + z_scale) / 3) ** 2)
subplot.scatter(x, y, z, color=mpl_colors, alpha=alphas, s=(size * 0.5 * (x_scale + y_scale + z_scale) / 3) ** 2)
elif isinstance(data.geometry, _EmbeddedGeometry):
raise NotImplementedError(f"Plotting embedded geometries not yet supported")
else:
Expand Down

0 comments on commit b1ca7d7

Please sign in to comment.