Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/spatialdata_plot/pl/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,11 @@ def _scatter_points(
x,
y,
s=size,
# No edge stroke: matplotlib's default (edgecolors="face", linewidths=1pt) strokes each
# circle marker with a fixed points-unit ring. When the fill disk goes sub-pixel (tiny
# `size` at high dpi) only that ring survives, rendering markers as hollow outlines.
# linewidths=0 keeps them solid fills whose radius honours `size`.
linewidths=0,
rasterized=sc_settings._vector_friendly,
alpha=alpha,
transform=trans_data,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_images/Points_can_annotate_points_with_table_obs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_images/Points_can_filter_with_groups_custom_palette.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_images/Points_can_filter_with_groups_default_palette.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_images/Points_can_stack_render_points.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_images/Points_can_use_norm_with_clip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_images/Points_can_use_norm_without_clip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_images/Points_datashader_matplotlib_stack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_images/Points_groups_na_color_none_filters_points.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_images/Points_points_render_permutations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions tests/pl/test_render_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dask.dataframe
import datashader as ds
import matplotlib
import matplotlib.collections
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -253,6 +254,22 @@ def test_render_points_missing_region_for_table_raises_key_error(self, sdata_blo
with pytest.raises(KeyError, match="does not annotate element"):
blob.pl.render_points(element="blobs_points", color="table_value", table_name="other_table")

def test_render_points_markers_have_no_edge_stroke(self, sdata_blobs: SpatialData) -> None:
# Regression test for #756: matplotlib's default scatter edge stroke (linewidths=1pt) turns
# small markers at high dpi into hollow "outlined" circles. The scatter collection must carry
# a zero linewidth so markers stay solid fills at every size.
# This is a fast, non-visual guard on the mechanism; the pixel-level "solid disk" appearance
# (whose only tell is a subtle annular minimum, awkward to assert without flakiness) is covered
# by the CI image-comparison baselines. A literal colour avoids the categorical legend's own
# (linewidth-1) scatter handles.
sdata_blobs.pl.render_points("blobs_points", color="red", size=0.1, method="matplotlib").pl.show(dpi=300)
ax = plt.gca()
collections = [c for c in ax.collections if isinstance(c, matplotlib.collections.PathCollection)]
assert collections, "no scatter collection was drawn"
for coll in collections:
assert np.all(coll.get_linewidths() == 0)
plt.close()

def test_plot_datashader_colors_from_table_obs(self, sdata_blobs: SpatialData):
n_obs = len(sdata_blobs["blobs_points"])
obs = pd.DataFrame(
Expand Down
Loading