If someone had a created Matplotlib figure with, e.g.,
from matplotlib import pyplot as plt
import numpy as np
plt.plot([1, 2, 3, 4], [1, 2, 3, 4])
ax = plt.gca()
ax.set_xscale('log', basex=np.e)
Is there a way to extract from the axis what that basex
value was? I can get the xscale
with ax.get_xscale()
, but there's no equivalent ax.get_basex()
.
As get_scale
return the name
field of the actual used matplotlib.scale.LogScale
object ax.get_xaxis()._scale
instead of the object itself, I unfortunately did not find another way then accessing base
of the private field _scale
directly. Accessing private fields is discouraged, but
ax.get_xaxis()._scale.base
gets you the result.