I’m struggling to find how to show the tick marks on the x-axis when I enable the whitegrid
seaborn style:
import datetime
import itertools
import random
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
import matplotlib.dates as mdates
chronos = np.arange('2024-03-01', '2024-07-01', dtype='datetime64[D]')
with sns.axes_style("whitegrid"):
sns.set({'xtick.bottom': True, 'xtick.top': True, 'patch.edgecolor': 'b'})
fig, ax = plt.subplots(figsize=(20, 4), layout='constrained')
sns.barplot(
x=chronos,
y=[random.randint(0, 10) for _ in chronos],
ax=ax,
width=1,
)
ax.tick_params(
axis='x',
rotation=30
)
ax.tick_params(axis="both", colors="black")
ax.xaxis.set_major_locator(
mdates.MonthLocator(
interval=1,
bymonthday=1
)
)
Without the style applied, the marks appear. I’ve looked at the docs but can’t figure out which option is removing them.
How do i show the tick marks with the seaborn style enabled?