I have the following code to plot a series of subplots:
minorLocator = AutoMinorLocator()
fig, ax = plt.subplots(4, 2, figsize=(8, 12))
data = np.random.rand(20,5)
ax[1, 1].plot(data, alpha=0.5)
ax[1, 1].set_title('Simulation')
ax[1, 1].xaxis.set_minor_locator(minorLocator)
However, this fails to include the minor tick 'markers' on the plot. I also tried
ax[1, 1].plot(data, alpha=0.5)
ax[1, 1].xaxis.set_minor_locator(minorLocator)
ax[1, 1].xaxis.set_minor_formatter(NullFormatter())
but it also fails. Since I'm working with seaborn styles, I suspect there's a need to override a Seaborn parameter but I'm not sure how. this is my Seaborn implementation
import seatborn as sns
sns.set()
How can I add the 'daily' marker to my x axis? These are examples of my plots:
Seaborn .set()
turns the ticks off by default. It uses it's darkgrid
style, which modifies the matplotlib rc parameters and sets the xtick.bottom
and ytick.left
parameters to False
(source).
A solution is to either set them to True
globally,
sns.set(rc={"xtick.bottom" : True, "ytick.left" : True})
or
sns.set()
plt.rcParams.update({"xtick.bottom" : True, "ytick.left" : True})
or, alternatively, to turn them on for the axes in question
ax[1, 1].tick_params(which="both", bottom=True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With