@@ -79,14 +79,18 @@ def limit_range_for_scale(self, vmin, vmax, minpos):
79
79
return vmin , vmax
80
80
81
81
82
- class TransformScaleBase (Transform ):
83
- """Base transform for scales to allow a deep copy"""
82
+ class CopyableTransformMixin ():
83
+ """
84
+ Mixin to support copy and deep copy on transforms. This alows scales,
85
+ and hence norms, to be copyable.
86
+ """
84
87
def __deepcopy__ (self , memo ):
85
88
return self .frozen ()
86
89
90
+ __copy__ = __deepcopy__
91
+
87
92
88
- class LinearTransform (TransformScaleBase , IdentityTransform ):
89
- """Mixed class for Identity"""
93
+ class LinearTransform (CopyableTransformMixin , IdentityTransform ):
90
94
pass
91
95
92
96
@@ -124,9 +128,9 @@ def get_transform(self):
124
128
return LinearTransform ()
125
129
126
130
127
- class FuncTransform (TransformScaleBase ):
131
+ class FuncTransform (CopyableTransformMixin , Transform ):
128
132
"""
129
- A simple transform that takes and arbitrary function for the
133
+ A transform that takes and arbitrary function for the
130
134
forward and inverse transform.
131
135
"""
132
136
@@ -202,7 +206,7 @@ def set_default_locators_and_formatters(self, axis):
202
206
axis .set_minor_locator (NullLocator ())
203
207
204
208
205
- class LogTransform (TransformScaleBase ):
209
+ class LogTransform (CopyableTransformMixin , Transform ):
206
210
input_dims = output_dims = 1
207
211
208
212
@_api .rename_parameter ("3.3" , "nonpos" , "nonpositive" )
@@ -244,7 +248,7 @@ def inverted(self):
244
248
return InvertedLogTransform (self .base )
245
249
246
250
247
- class InvertedLogTransform (TransformScaleBase ):
251
+ class InvertedLogTransform (CopyableTransformMixin , Transform ):
248
252
input_dims = output_dims = 1
249
253
250
254
def __init__ (self , base ):
@@ -370,7 +374,7 @@ def get_transform(self):
370
374
return self ._transform
371
375
372
376
373
- class SymmetricalLogTransform (TransformScaleBase ):
377
+ class SymmetricalLogTransform (CopyableTransformMixin , Transform ):
374
378
input_dims = output_dims = 1
375
379
376
380
def __init__ (self , base , linthresh , linscale ):
@@ -402,7 +406,7 @@ def inverted(self):
402
406
self .linscale )
403
407
404
408
405
- class InvertedSymmetricalLogTransform (TransformScaleBase ):
409
+ class InvertedSymmetricalLogTransform (CopyableTransformMixin , Transform ):
406
410
input_dims = output_dims = 1
407
411
408
412
def __init__ (self , base , linthresh , linscale ):
@@ -505,7 +509,7 @@ def get_transform(self):
505
509
return self ._transform
506
510
507
511
508
- class LogitTransform (TransformScaleBase ):
512
+ class LogitTransform (CopyableTransformMixin , Transform ):
509
513
input_dims = output_dims = 1
510
514
511
515
@_api .rename_parameter ("3.3" , "nonpos" , "nonpositive" )
@@ -531,7 +535,7 @@ def __str__(self):
531
535
return "{}({!r})" .format (type (self ).__name__ , self ._nonpositive )
532
536
533
537
534
- class LogisticTransform (TransformScaleBase ):
538
+ class LogisticTransform (CopyableTransformMixin , Transform ):
535
539
input_dims = output_dims = 1
536
540
537
541
@_api .rename_parameter ("3.3" , "nonpos" , "nonpositive" )
0 commit comments