@@ -253,18 +253,13 @@ def __init__(
253253 self ._dark = self ._dark or black
254254
255255 if not self .cmap and not self ._is_categorical :
256- self ._choose_cmap ()
256+ self ._choose_cmap (** kwargs )
257257
258258 if not legend :
259259 self .legend = None
260260 else :
261261 self ._create_legend ()
262262
263- self ._dark_or_light ()
264-
265- if cmap :
266- self ._cmap = cmap
267-
268263 new_kwargs = {}
269264 for key , value in self .kwargs .items ():
270265 if key not in MAP_KWARGS :
@@ -286,6 +281,11 @@ def __init__(
286281 except Exception :
287282 setattr (self .legend , f"_{ key } " , value )
288283
284+ self ._dark_or_light ()
285+
286+ if cmap :
287+ self ._cmap = cmap
288+
289289 self .bounds = (
290290 to_bbox (bounds ) if bounds is not None else to_bbox (self ._gdf .total_bounds )
291291 )
@@ -589,16 +589,16 @@ def _create_legend(self) -> None:
589589 else :
590590 self .legend = ContinousLegend (title = self ._column , size = self ._size )
591591
592- def _choose_cmap (self ) -> None :
592+ def _choose_cmap (self , ** kwargs ) -> None :
593593 """Kwargs is to catch start and stop points for the cmap in __init__."""
594594 if self ._dark :
595595 self ._cmap = "viridis"
596- self .cmap_start = 0
597- self .cmap_stop = 256
596+ self .cmap_start = self . kwargs . pop ( "cmap_start" , 0 )
597+ self .cmap_stop = self . kwargs . pop ( "cmap_stop" , 256 )
598598 else :
599599 self ._cmap = "RdPu"
600- self .cmap_start = 23
601- self .cmap_stop = 256
600+ self .cmap_start = self . kwargs . pop ( "cmap_start" , 23 )
601+ self .cmap_stop = self . kwargs . pop ( "cmap_stop" , 256 )
602602
603603 def _make_bin_value_dict (self , gdf : GeoDataFrame , classified : np .ndarray ) -> dict :
604604 """Dict with unique values of all bins. Used in labels in ContinousLegend."""
@@ -609,8 +609,6 @@ def _make_bin_value_dict(self, gdf: GeoDataFrame, classified: np.ndarray) -> dic
609609 return bins_unique_values
610610
611611 def _actually_add_background (self ) -> None :
612- # self.ax.set_xlim([self.minx - self.diffx * 0.03, self.maxx + self.diffx * 0.03])
613- # self.ax.set_ylim([self.miny - self.diffy * 0.03, self.maxy + self.diffy * 0.03])
614612 self ._background_gdfs .plot (
615613 ax = self .ax , color = self .bg_gdf_color , ** self .bg_gdf_kwargs
616614 )
@@ -632,13 +630,14 @@ def _dark_or_light(self) -> None:
632630 )
633631 self .nan_color = "#666666" if self ._nan_color_was_none else self .nan_color
634632 if not self ._is_categorical :
635- self .change_cmap ( "viridis" )
633+ self ._cmap = self . kwargs . get ( "cmap" , "viridis" )
636634
637635 if self .legend is not None :
638636 for key , color in {
639637 "facecolor" : "#0f0f0f" ,
640638 "labelcolor" : "#fefefe" ,
641639 "title_color" : "#fefefe" ,
640+ "edgecolor" : "#0f0f0f" ,
642641 }.items ():
643642 setattr (self .legend , key , color )
644643
@@ -650,13 +649,14 @@ def _dark_or_light(self) -> None:
650649 )
651650 self .nan_color = "#c2c2c2" if self ._nan_color_was_none else self .nan_color
652651 if not self ._is_categorical :
653- self .change_cmap ( "RdPu " , start = 23 )
652+ self ._cmap = self . kwargs . get ( "cmap " , "RdPu" )
654653
655654 if self .legend is not None :
656655 for key , color in {
657656 "facecolor" : "#fefefe" ,
658657 "labelcolor" : "#0f0f0f" ,
659658 "title_color" : "#0f0f0f" ,
659+ "edgecolor" : "#0f0f0f" ,
660660 }.items ():
661661 setattr (self .legend , key , color )
662662
0 commit comments