Skip to content

Commit

Permalink
Small fix/circles as points (#334)
Browse files Browse the repository at this point in the history
* re-enable showing circles as points

* fix pre-commit local ignore

* fixes circles as points
  • Loading branch information
LucaMarconato authored Dec 17, 2024
1 parent 2bc64cb commit e19e94c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/napari_spatialdata/_scatterwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from napari_spatialdata._model import DataModel
from napari_spatialdata._widgets import AListWidget, ComponentWidget
from napari_spatialdata.constants.config import POINT_SIZE_SCATTERPLOT_WIDGET

__all__ = [
"PlotWidget",
Expand Down Expand Up @@ -343,7 +344,7 @@ def __init__(self, viewer: Viewer | None, model: DataModel) -> None:

# Create a separate ScatterPlotItem for the highlighted point
self.hovered_point = pg.ScatterPlotItem(
pen=pg.mkPen("r", width=2), symbol="o", size=6, brush=pg.mkBrush(255, 0, 0)
pen=pg.mkPen("r", width=2), symbol="o", size=POINT_SIZE_SCATTERPLOT_WIDGET, brush=pg.mkBrush(255, 0, 0)
)
self.scatter_plot.addItem(self.hovered_point)

Expand Down
2 changes: 1 addition & 1 deletion src/napari_spatialdata/_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from napari_spatialdata._model import DataModel
from napari_spatialdata.constants import config
from napari_spatialdata.constants.config import CIRCLES_AS_POINTS
from napari_spatialdata.utils._utils import (
_adjust_channels_order,
_get_ellipses_from_circles,
Expand Down Expand Up @@ -531,7 +532,6 @@ def get_sdata_circles(self, sdata: SpatialData, key: str, selected_cs: str, mult
),
}

CIRCLES_AS_POINTS = True
version = get_napari_version()
kwargs: dict[str, Any] = (
{"edge_width": 0.0}
Expand Down
3 changes: 2 additions & 1 deletion src/napari_spatialdata/constants/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
POINT_THRESHOLD = 100000
N_CIRCLES_WARNING_THRESHOLD = 250000
N_SHAPES_WARNING_THRESHOLD = 10000
POINT_SIZE_SCATTERPLOT_WIDGET = 5
POINT_SIZE_SCATTERPLOT_WIDGET = 6
CIRCLES_AS_POINTS = True

0 comments on commit e19e94c

Please sign in to comment.