@@ -149,7 +149,7 @@ def _render_shapes(
149
149
# Apply the transformation to the PatchCollection's paths
150
150
trans = get_transformation (sdata_filt .shapes [element ], get_all = True )[coordinate_system ]
151
151
affine_trans = trans .to_affine_matrix (input_axes = ("x" , "y" ), output_axes = ("x" , "y" ))
152
- trans = mtransforms .Affine2D (matrix = affine_trans )
152
+ trans = mtransforms .Affine2D (matrix = affine_trans ) + ax . transData
153
153
154
154
shapes = gpd .GeoDataFrame (shapes , geometry = "geometry" )
155
155
@@ -162,9 +162,6 @@ def _render_shapes(
162
162
logger .info (f"Using { method } " )
163
163
164
164
if method == "datashader" :
165
- # TODO: Where to put this
166
- trans = mtransforms .Affine2D (matrix = affine_trans ) + ax .transData
167
-
168
165
extent = get_extent (sdata .shapes [element ])
169
166
x_ext = extent ["x" ][1 ]
170
167
y_ext = extent ["y" ][1 ]
@@ -186,7 +183,6 @@ def _render_shapes(
186
183
187
184
# in case we are coloring by a column in table
188
185
if col_for_color is not None and col_for_color not in sdata_filt .shapes [element ].columns :
189
- # numerical
190
186
sdata_filt .shapes [element ][col_for_color ] = (
191
187
color_vector if color_source_vector is None else color_source_vector
192
188
)
@@ -199,7 +195,6 @@ def _render_shapes(
199
195
sdata_filt .shapes [element ], geometry = "geometry" , agg = ds .by (col_for_color , ds .count ())
200
196
)
201
197
else :
202
- # numerical
203
198
agg = cvs .polygons (sdata_filt .shapes [element ], geometry = "geometry" , agg = ds .sum (column = col_for_color ))
204
199
# save min and max values for drawing the colorbar
205
200
aggregate_with_sum = (agg .min (), agg .max ())
@@ -226,7 +221,6 @@ def _render_shapes(
226
221
cmap = render_params .cmap_params .cmap ,
227
222
)
228
223
)
229
- # Render image
230
224
rgba_image = np .transpose (ds_result .to_numpy ().base , (0 , 1 , 2 ))
231
225
_cax = ax .imshow (rgba_image , cmap = palette , zorder = render_params .zorder )
232
226
_cax .set_transform (trans )
@@ -335,7 +329,6 @@ def _render_points(
335
329
336
330
if groups is not None and col_for_color is not None :
337
331
points = points [points [col_for_color ].isin (groups )]
338
- # in case no rows are left:
339
332
if len (points ) <= 0 :
340
333
raise ValueError (f"None of the groups { groups } could be found in the column '{ col_for_color } '." )
341
334
@@ -398,14 +391,6 @@ def _render_points(
398
391
affine_trans = trans .to_affine_matrix (input_axes = ("x" , "y" ), output_axes = ("x" , "y" ))
399
392
trans = mtransforms .Affine2D (matrix = affine_trans ) + ax .transData
400
393
401
- # color_source_vector is None when the values aren't categorical
402
- if color_source_vector is None and render_params .transfunc is not None :
403
- color_vector = render_params .transfunc (color_vector )
404
-
405
- trans = get_transformation (sdata .points [element ], get_all = True )[coordinate_system ]
406
- affine_trans = trans .to_affine_matrix (input_axes = ("x" , "y" ), output_axes = ("x" , "y" ))
407
- trans = mtransforms .Affine2D (matrix = affine_trans ) + ax .transData
408
-
409
394
norm = copy (render_params .cmap_params .norm )
410
395
411
396
method = render_params .method
@@ -435,7 +420,6 @@ def _render_points(
435
420
plot_height = int (np .round (y_ext [1 ] - y_ext [0 ]))
436
421
437
422
# use datashader for the visualization of points
438
- # TODO: what about trans/norm at this point?
439
423
cvs = ds .Canvas (plot_width = plot_width , plot_height = plot_height , x_range = x_ext , y_range = y_ext )
440
424
441
425
color_by_categorical = col_for_color is not None and points [col_for_color ].values .dtype == object
@@ -444,7 +428,6 @@ def _render_points(
444
428
if color_by_categorical :
445
429
agg = cvs .points (sdata_filt .points [element ], "x" , "y" , agg = ds .by (col_for_color , ds .count ()))
446
430
else :
447
- # numerical
448
431
agg = cvs .points (sdata_filt .points [element ], "x" , "y" , agg = ds .sum (column = col_for_color ))
449
432
# save min and max values for drawing the colorbar
450
433
aggregate_with_sum = (agg .min (), agg .max ())
@@ -633,7 +616,6 @@ def _render_images(
633
616
clip = True ,
634
617
)
635
618
636
- # TODO: can't be list anymore???
637
619
if not isinstance (render_params .cmap_params , list ):
638
620
if render_params .cmap_params .norm is not None :
639
621
layers [c ] = render_params .cmap_params .norm (layers [c ])
0 commit comments