Skip to content

Commit d43d3e7

Browse files
[pre-commit.ci] pre-commit autoupdate (#356)
2 parents 16d057e + e2e6709 commit d43d3e7

File tree

4 files changed

+76
-74
lines changed

4 files changed

+76
-74
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ ci:
99
skip: []
1010
repos:
1111
- repo: https://github.com/psf/black
12-
rev: 24.8.0
12+
rev: 24.10.0
1313
hooks:
1414
- id: black
1515
- repo: https://github.com/pre-commit/mirrors-prettier
1616
rev: v4.0.0-alpha.8
1717
hooks:
1818
- id: prettier
1919
- repo: https://github.com/asottile/blacken-docs
20-
rev: 1.18.0
20+
rev: 1.19.1
2121
hooks:
2222
- id: blacken-docs
2323
- repo: https://github.com/pre-commit/mirrors-mypy
24-
rev: v1.11.2
24+
rev: v1.14.0
2525
hooks:
2626
- id: mypy
2727
additional_dependencies: [numpy, types-requests]
2828
exclude: tests/|docs/
2929
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: v0.6.4
30+
rev: v0.8.4
3131
hooks:
3232
- id: ruff
3333
args: [--fix, --exit-non-zero-on-fix]

CHANGELOG.md

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -12,169 +12,169 @@ and this project adheres to [Semantic Versioning][].
1212

1313
### Fixed
1414

15-
- Transformations of Points and Shapes are now applied before rendering with datashader (#378)
16-
- Fix bug due to `sc.get.obs_df()` returning a different type (#393)
17-
- Allowing instance mismatch between shapes and tables (#396)
18-
- Fix bug when plotting categorical points with datashader (#395)
15+
- Transformations of Points and Shapes are now applied before rendering with datashader (#378)
16+
- Fix bug due to `sc.get.obs_df()` returning a different type (#393)
17+
- Allowing instance mismatch between shapes and tables (#396)
18+
- Fix bug when plotting categorical points with datashader (#395)
1919

2020
## [0.2.8] - 2024-11-26
2121

2222
### Changed
2323

24-
- Support for `xarray.DataTree` (which moved from `datatree.DataTree`) (#380)
24+
- Support for `xarray.DataTree` (which moved from `datatree.DataTree`) (#380)
2525

2626
## [0.2.7] - 2024-10-24
2727

2828
### Added
2929

30-
- The user can now specify `datashader_reduction` to control the rendering behavior (#309)
31-
- Rendering outlines of shapes with datashader works now (#309)
30+
- The user can now specify `datashader_reduction` to control the rendering behavior (#309)
31+
- Rendering outlines of shapes with datashader works now (#309)
3232

3333
### Fixed
3434

35-
- datashader now uses canvas size = image size which speeds up the rendering (#309)
36-
- datashader now uses the `linear` as interpolation method for colormaps instead of the default `eq_hist` to make it equivalent to matplotlib (#309)
37-
- point sizes of datashader now agree with matplotlib also when dpi != 100 (#309)
38-
- Giving a custom colormap when rendering a multiscale image now works (#586)
35+
- datashader now uses canvas size = image size which speeds up the rendering (#309)
36+
- datashader now uses the `linear` as interpolation method for colormaps instead of the default `eq_hist` to make it equivalent to matplotlib (#309)
37+
- point sizes of datashader now agree with matplotlib also when dpi != 100 (#309)
38+
- Giving a custom colormap when rendering a multiscale image now works (#586)
3939

4040
## [0.2.6] - 2024-09-04
4141

4242
### Changed
4343

44-
- Lowered RMSE-threshold for plot-based tests from 45 to 15 (#344)
45-
- When subsetting to `groups`, `NA` isn't automatically added to legend (#344)
46-
- When rendering a single image channel, a colorbar is now shown (#346)
47-
- Removed `percentiles_for_norm` parameter (#346)
48-
- Changed `norm` to no longer accept bools, only `mpl.colors.Normalise` or `None` (#346)
44+
- Lowered RMSE-threshold for plot-based tests from 45 to 15 (#344)
45+
- When subsetting to `groups`, `NA` isn't automatically added to legend (#344)
46+
- When rendering a single image channel, a colorbar is now shown (#346)
47+
- Removed `percentiles_for_norm` parameter (#346)
48+
- Changed `norm` to no longer accept bools, only `mpl.colors.Normalise` or `None` (#346)
4949

5050
### Fixed
5151

52-
- Filtering with `groups` now preserves original cmap (#344)
53-
- Non-selected `groups` are now not shown in `na_color` (#344)
54-
- Several issues associated with `norm` and `colorbar` (#346)
52+
- Filtering with `groups` now preserves original cmap (#344)
53+
- Non-selected `groups` are now not shown in `na_color` (#344)
54+
- Several issues associated with `norm` and `colorbar` (#346)
5555

5656
## [0.2.5] - 2024-08-23
5757

5858
### Changed
5959

60-
- Replaced `outline` parameter in `render_labels` with alpha-based logic (#323)
61-
- Lowered RMSE-threshold for plot-based tests from 60 to 45 (#323)
62-
- Removed `preprocessing` (.pp) accessor (#329)
60+
- Replaced `outline` parameter in `render_labels` with alpha-based logic (#323)
61+
- Lowered RMSE-threshold for plot-based tests from 60 to 45 (#323)
62+
- Removed `preprocessing` (.pp) accessor (#329)
6363

6464
### Fixed
6565

66-
- Minor fixes for several tests as a result of the threshold change (#323)
66+
- Minor fixes for several tests as a result of the threshold change (#323)
6767

6868
## [0.2.4] - 2024-08-07
6969

7070
### Added
7171

72-
- Added utils function for 0-transparent cmaps (#302)
72+
- Added utils function for 0-transparent cmaps (#302)
7373

7474
### Fixed
7575

76-
- Took RNG out of categorical label test (#306)
77-
- Performance bug when plotting shapes (#298)
78-
- scale parameter was ignored for single-scale images (#301)
79-
- Changes to support for dask-expr (#283)
80-
- Added error handling for non-existent elements (#305)
81-
- Specifying vmin and vmax properly clips image data (#307)
82-
- import bug `get_cmap()` (8fd969c)
76+
- Took RNG out of categorical label test (#306)
77+
- Performance bug when plotting shapes (#298)
78+
- scale parameter was ignored for single-scale images (#301)
79+
- Changes to support for dask-expr (#283)
80+
- Added error handling for non-existent elements (#305)
81+
- Specifying vmin and vmax properly clips image data (#307)
82+
- import bug `get_cmap()` (8fd969c)
8383

8484
## [0.2.3] - 2024-07-03
8585

8686
### Added
8787

88-
- Datashader support for points and shapes (#244)
88+
- Datashader support for points and shapes (#244)
8989

9090
### Changed
9191

92-
- All parameters are now provided for a single element (#272)
92+
- All parameters are now provided for a single element (#272)
9393

9494
### Fixed
9595

96-
- Fix color assignment for NaN values (#257)
97-
- Zorder of rendering now strictly follows the order of the render_x calls (#244)
96+
- Fix color assignment for NaN values (#257)
97+
- Zorder of rendering now strictly follows the order of the render_x calls (#244)
9898

9999
## [0.2.2] - 2024-05-02
100100

101101
### Fixed
102102

103-
- Fixed `fill_alpha` ignoring `alpha` channel from custom cmap (#236)
104-
- Fix channel str support (#221)
103+
- Fixed `fill_alpha` ignoring `alpha` channel from custom cmap (#236)
104+
- Fix channel str support (#221)
105105

106106
## [0.2.1] - 2024-03-26
107107

108108
### Minor
109109

110-
- Adjusted GitHub worklows
110+
- Adjusted GitHub worklows
111111

112112
## [0.2.0] - 2024-03-24
113113

114114
### Added
115115

116-
- Support for plotting multiple tables @melonora
116+
- Support for plotting multiple tables @melonora
117117

118118
### Fixed
119119

120-
- Several bugfixes, especially for colors and palettes @melonora
120+
- Several bugfixes, especially for colors and palettes @melonora
121121

122122
## [0.1.0] - 2024-01-17
123123

124124
### Added
125125

126-
- Multiscale image handling: user can specify a scale, else the best scale is selected automatically given the figure size and dpi (#164)
127-
- Large images are automatically rasterized to speed up performance (#164)
128-
- Added better error message for mismatch in cs and ax number (#185)
129-
- Beter test coverage for correct plotting of elements after transformation (#198)
130-
- Can now stack render commands (#190, #192)
131-
- The `color` argument in render_shapes/points now accepts actual colors as well (#199)
132-
- Input arguments are now evaulated for their types in basic.py (#199)
126+
- Multiscale image handling: user can specify a scale, else the best scale is selected automatically given the figure size and dpi (#164)
127+
- Large images are automatically rasterized to speed up performance (#164)
128+
- Added better error message for mismatch in cs and ax number (#185)
129+
- Beter test coverage for correct plotting of elements after transformation (#198)
130+
- Can now stack render commands (#190, #192)
131+
- The `color` argument in render_shapes/points now accepts actual colors as well (#199)
132+
- Input arguments are now evaulated for their types in basic.py (#199)
133133

134134
### Fixed
135135

136-
- Now dropping index when plotting shapes after spatial query (#177)
137-
- Points are now being correctly rotated (#198)
138-
- User can now pass Colormap objects to the cmap argument in render_images. When only one cmap is given for 3 channels, it is now applied to each channel (#188, #194)
136+
- Now dropping index when plotting shapes after spatial query (#177)
137+
- Points are now being correctly rotated (#198)
138+
- User can now pass Colormap objects to the cmap argument in render_images. When only one cmap is given for 3 channels, it is now applied to each channel (#188, #194)
139139

140140
## [0.0.6] - 2023-11-06
141141

142142
### Added
143143

144-
- Pushed `get_extent` functionality upstream to `spatialdata` (#162)
144+
- Pushed `get_extent` functionality upstream to `spatialdata` (#162)
145145

146146
## [0.0.5] - 2023-10-02
147147

148148
### Added
149149

150-
- Can now scale shapes (#152)
151-
- Can now plot columns from GeoDataFrame (#149)
150+
- Can now scale shapes (#152)
151+
- Can now plot columns from GeoDataFrame (#149)
152152

153153
### Fixed
154154

155-
- Multipolygons are now handled correctly (#93)
156-
- Legend order is now deterministic (#143)
157-
- Images no longer normalised by default (#150)
158-
- Filtering of shapes and points using the `groups` argument is now possible, coloring by palette and cmap arguments works for shapes and points (#153)
159-
- Colorbar no longer autoscales to [0, 1] (#155)
160-
- Plotting shapes after a spatial query is now possible (#163)
155+
- Multipolygons are now handled correctly (#93)
156+
- Legend order is now deterministic (#143)
157+
- Images no longer normalised by default (#150)
158+
- Filtering of shapes and points using the `groups` argument is now possible, coloring by palette and cmap arguments works for shapes and points (#153)
159+
- Colorbar no longer autoscales to [0, 1] (#155)
160+
- Plotting shapes after a spatial query is now possible (#163)
161161

162162
## [0.0.4] - 2023-08-11
163163

164164
### Fixed
165165

166-
- Multi-scale images/labels are now correctly substituted and the action is logged (#131).
167-
- Empty geometries among the shapes can be handeled (#133).
168-
- `outline_width` parameter in render_shapes is now a float that actually determines the line width (#139).
166+
- Multi-scale images/labels are now correctly substituted and the action is logged (#131).
167+
- Empty geometries among the shapes can be handeled (#133).
168+
- `outline_width` parameter in render_shapes is now a float that actually determines the line width (#139).
169169

170170
## [0.0.2] - 2023-06-25
171171

172172
### Fixed
173173

174-
- Multiple bugfixes of which I didn't keep track of.
174+
- Multiple bugfixes of which I didn't keep track of.
175175

176176
## [0.0.1] - 2023-04-04
177177

178178
### Added
179179

180-
- Initial release of `spatialdata-plot` with support for `images`, `labels`, `points` and `shapes`.
180+
- Initial release of `spatialdata-plot` with support for `images`, `labels`, `points` and `shapes`.

src/spatialdata_plot/pl/basic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def render_shapes(
272272
scale=scale,
273273
table_name=table_name,
274274
method=method,
275-
ds_reduction=kwargs.get("datashader_reduction", None),
275+
ds_reduction=kwargs.get("datashader_reduction"),
276276
)
277277

278278
sdata = self._copy()
@@ -296,7 +296,7 @@ def render_shapes(
296296
palette=param_values["palette"],
297297
outline_alpha=param_values["outline_alpha"],
298298
fill_alpha=param_values["fill_alpha"],
299-
transfunc=kwargs.get("transfunc", None),
299+
transfunc=kwargs.get("transfunc"),
300300
table_name=param_values["table_name"],
301301
zorder=n_steps,
302302
method=param_values["method"],
@@ -403,7 +403,7 @@ def render_points(
403403
norm=norm,
404404
size=size,
405405
table_name=table_name,
406-
ds_reduction=kwargs.get("datashader_reduction", None),
406+
ds_reduction=kwargs.get("datashader_reduction"),
407407
)
408408

409409
if method is not None:
@@ -430,7 +430,7 @@ def render_points(
430430
cmap_params=cmap_params,
431431
palette=param_values["palette"],
432432
alpha=param_values["alpha"],
433-
transfunc=kwargs.get("transfunc", None),
433+
transfunc=kwargs.get("transfunc"),
434434
size=param_values["size"],
435435
table_name=param_values["table_name"],
436436
zorder=n_steps,
@@ -675,7 +675,7 @@ def render_labels(
675675
palette=param_values["palette"],
676676
outline_alpha=param_values["outline_alpha"],
677677
fill_alpha=param_values["fill_alpha"],
678-
transfunc=kwargs.get("transfunc", None),
678+
transfunc=kwargs.get("transfunc"),
679679
scale=param_values["scale"],
680680
table_name=param_values["table_name"],
681681
zorder=n_steps,

src/spatialdata_plot/pl/render.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,10 @@ def _render_images(
717717
extent=extent,
718718
)
719719

720-
channels = img.coords["c"].values if render_params.channel is None else render_params.channel
720+
channels = img.coords["c"].values.tolist() if render_params.channel is None else render_params.channel
721721

722+
# the channel parameter has been previously validated, so when not None, render_params.channel is a list
723+
assert isinstance(channels, list)
722724
n_channels = len(channels)
723725

724726
# True if user gave n cmaps for n channels

0 commit comments

Comments
 (0)