@@ -281,14 +281,12 @@ def __init__(
281
281
``ax.dual%(x)s((lambda x: x**2, lambda x: x**0.5))``.
282
282
Again, if the first function is linear or involutory, you do
283
283
not need to provide the second!
284
- * A `~matplotlib.scale.ScaleBase` instance, e.g. a scale returned
285
- by the `~proplot.constructor.Scale` constructor function. The
286
- forward transformation, inverse transformation, and default axis
287
- locators and formatters are borrowed from the resulting scale
288
- class. For example, to apply the inverse, use
289
- ``ax.dual%(x)s(plot.Scale('inverse'))``.
290
- To apply the base-10 exponential function, use
291
- ``ax.dual%(x)s(plot.Scale('exp', 10))``.
284
+ * A scale specification interpreted by the `~proplot.constructor.Scale`
285
+ constructor function. The forward transformation, inverse transformation,
286
+ and default axis locators and formatters are borrowed from the resulting
287
+ `~matplotlib.scale.ScaleBase` instance. For example, to apply the
288
+ inverse, use ``ax.dual%(x)s('inverse')``. To apply the base-10
289
+ exponential function, use ``ax.dual%(x)s(('exp', 10))``.
292
290
293
291
invert : bool, optional
294
292
If ``True``, the forward and inverse functions are *swapped*.
@@ -316,16 +314,18 @@ def __init__(
316
314
forward = inverse = arg
317
315
elif np .iterable (arg ) and len (arg ) == 2 and all (map (callable , arg )):
318
316
forward , inverse = arg
319
- elif isinstance (arg , mscale .ScaleBase ):
320
- trans = arg .get_transform ()
317
+ else :
318
+ from .constructor import Scale
319
+ try :
320
+ scale = Scale (arg )
321
+ except ValueError :
322
+ raise ValueError (
323
+ 'Input should be a function, 2-tuple of forward and and inverse '
324
+ f'functions, or an axis scale specification, not { arg !r} .'
325
+ )
326
+ trans = scale .get_transform ()
321
327
forward = trans .transform
322
328
inverse = trans .inverted ().transform
323
- else :
324
- raise ValueError (
325
- 'Input should be a function, 2-tuple of forward and '
326
- 'and inverse functions, or a matplotlib.scale.ScaleBase '
327
- f'instance, not { arg !r} .'
328
- )
329
329
330
330
# Create the FuncTransform or composite transform used for this class
331
331
# May need to invert functions for dualx() and dualy()
0 commit comments