- Similar to this answer, except iterate through each axes.
- This answer explains that seaborn
.set()
turns the ticks off by default, uses its darkgrid style, which modifies the matplotlib rc parameters, and sets the xtick.bottom
and ytick.left
parameters to False
, however the options in the answer do not resolve the issue.
sns.set
may be removed in future releases.
- Tested in
python 3.10
, pandas 1.4.2
, matplotlib 3.5.1
, seaborn 0.11.2
import matplotlib.ticker as mticker
import seaborn as sns
import numpy as np
sns.set(font_scale=2)
g = sns.relplot(data=tips, height=5, x="total_bill", y="tip", hue="day", col="time")
g.set(xscale='log')
# iterate through each axes
for ax in g.axes.flat:
ax.grid(True, which="both", axis='x', ls="--")
locmin = mticker.LogLocator(base=10, subs=np.arange(0.1,1,0.1), numticks=10)
ax.xaxis.set_minor_locator(locmin)

With sns.set(font_scale=2, style='ticks')
sns.set(font_scale=2, style='ticks') # or sns.set_theme(...)
g = sns.relplot(data=tips, height=5, x="total_bill", y="tip", hue="day", col="time")
g.set(xscale='log')
for ax in g.axes.flat:
locmin = mticker.LogLocator(base=10, subs=np.arange(0.1, 1, 0.1), numticks=10)
ax.xaxis.set_minor_locator(locmin)

Without Using .set
