matplotlib の軸が対数/線形かどうかを確認する簡単な方法はありますか?
ax.transData.__dict__
(ax is semilogy
) と入力すると、次のようになります。
{'_a': TransformWrapper(BlendedGenericTransform(IdentityTransform(),<matplotlib.scale.Log10Transform object at 0x10ffb3650>)),
'_b': CompositeGenericTransform(BboxTransformFrom(TransformedBbox(Bbox('array([[ 0.00000000e+00, 1.00000000e+00],\n [ 2.00000000e+03, 1.00000000e+08]])'), TransformWrapper(BlendedGenericTransform(IdentityTransform(),<matplotlib.scale.Log10Transform object at 0x10ffb3650>)))), BboxTransformTo(TransformedBbox(Bbox('array([[ 0.05482517, 0.05046296],\n [ 0.96250543, 0.95810185]])'), BboxTransformTo(TransformedBbox(Bbox('array([[ 0., 0.],\n [ 8., 6.]])'), Affine2D(array([[ 80., 0., 0.],
[ 0., 80., 0.],
[ 0., 0., 1.]]))))))),
'_invalid': 2,
'_parents': <WeakValueDictionary at 4572332904>,
'_shorthand_name': '',
'input_dims': 2,
'output_dims': 2}
サブトランスフォームax.transData._a._child
が対数スケールであるかどうかを確認するメソッドを作成できますが、変数名が変更される可能性があるため、プライベート変数にアクセスするのが好きではなく、かなり持続可能ではないようです。