@@ -79,6 +79,17 @@ def limit_range_for_scale(self, vmin, vmax, minpos):
79
79
return vmin , vmax
80
80
81
81
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
+ """
87
+ def __deepcopy__ (self , memo ):
88
+ return self .frozen ()
89
+
90
+ __copy__ = __deepcopy__
91
+
92
+
82
93
class LinearScale (ScaleBase ):
83
94
"""
84
95
The default linear scale.
@@ -113,9 +124,9 @@ def get_transform(self):
113
124
return IdentityTransform ()
114
125
115
126
116
- class FuncTransform (Transform ):
127
+ class FuncTransform (_CopyableTransformMixin , Transform ):
117
128
"""
118
- A simple transform that takes and arbitrary function for the
129
+ A transform that takes and arbitrary function for the
119
130
forward and inverse transform.
120
131
"""
121
132
@@ -191,7 +202,7 @@ def set_default_locators_and_formatters(self, axis):
191
202
axis .set_minor_locator (NullLocator ())
192
203
193
204
194
- class LogTransform (Transform ):
205
+ class LogTransform (_CopyableTransformMixin , Transform ):
195
206
input_dims = output_dims = 1
196
207
197
208
@_api .rename_parameter ("3.3" , "nonpos" , "nonpositive" )
@@ -233,7 +244,7 @@ def inverted(self):
233
244
return InvertedLogTransform (self .base )
234
245
235
246
236
- class InvertedLogTransform (Transform ):
247
+ class InvertedLogTransform (_CopyableTransformMixin , Transform ):
237
248
input_dims = output_dims = 1
238
249
239
250
def __init__ (self , base ):
@@ -359,7 +370,7 @@ def get_transform(self):
359
370
return self ._transform
360
371
361
372
362
- class SymmetricalLogTransform (Transform ):
373
+ class SymmetricalLogTransform (_CopyableTransformMixin , Transform ):
363
374
input_dims = output_dims = 1
364
375
365
376
def __init__ (self , base , linthresh , linscale ):
@@ -391,7 +402,7 @@ def inverted(self):
391
402
self .linscale )
392
403
393
404
394
- class InvertedSymmetricalLogTransform (Transform ):
405
+ class InvertedSymmetricalLogTransform (_CopyableTransformMixin , Transform ):
395
406
input_dims = output_dims = 1
396
407
397
408
def __init__ (self , base , linthresh , linscale ):
@@ -494,7 +505,7 @@ def get_transform(self):
494
505
return self ._transform
495
506
496
507
497
- class LogitTransform (Transform ):
508
+ class LogitTransform (_CopyableTransformMixin , Transform ):
498
509
input_dims = output_dims = 1
499
510
500
511
@_api .rename_parameter ("3.3" , "nonpos" , "nonpositive" )
@@ -520,7 +531,7 @@ def __str__(self):
520
531
return "{}({!r})" .format (type (self ).__name__ , self ._nonpositive )
521
532
522
533
523
- class LogisticTransform (Transform ):
534
+ class LogisticTransform (_CopyableTransformMixin , Transform ):
524
535
input_dims = output_dims = 1
525
536
526
537
@_api .rename_parameter ("3.3" , "nonpos" , "nonpositive" )
0 commit comments