The default log scale in seaborn.objects
doesn't show the minor log grid lines. How can they be turned on?
#Synthetic data
import pandas as pd
from scipy.stats import expon
data = pd.DataFrame({'rate': expon(scale=110).rvs(100),
'value': np.random.randn(100)}
)
#Default: no minor log ticks
display(
so.Plot(data, y='value', x='rate')
.add(so.Dots())
.scale(x='log')
.layout(size=(7, 3))
)
The following configuration (using matplotlib.ticker.LogLocator
) gave me the minor log tick marks.
from matplotlib.ticker import LogLocator
#(Make synthetic data as per OP's code)
#Plot with minor tick marks on log scale
(
so.Plot(data, y='value', x='rate')
.add(so.Dots())
.scale(x=so.Continuous(trans='log').tick(locator=LogLocator(subs='all')))
.layout(size=(7, 3))
)
As far as I can tell, there isn't an argument for directly toggling minor grids. I tried .scale(x=so.Continuous(trans='log').tick(minor=10))
to force 10 minor tick marks between each major tick, but this doesn't seem to have an effect and is only for "unlabelled" ticks according to the docs.
I'd be interested in seeing alternative methods you think would work for this task.