I am trying to place the Y-axis major ticks in dedicated locations in a symlog boxplot. The MWE that I have is this one:
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import ticker
url = 'https://public.tableau.com/app/sample-data/titanic%20passenger%20list.csv'
titanic = pd.read_csv(url)
ax = sns.boxplot(x=titanic["age"].round(-1), y=titanic["fare"], native_scale=True)
ax.set_yscale('symlog', linthresh=1)
ax.set_ylim(bottom=-1,top = 10**8) # purposely increasing the y-axis upper lim
ax.yaxis.set_major_locator(ticker.SymmetricalLogLocator(base=10.0, linthresh=1, subs=[10**i for i in range(0,8,2)]))
plt.show()
The question here regards the subs
argument of the SymmetricalLogLocator
which is clearly wrong judging from the output the above snippet yields. For instance, with the comprehension of
[subs = [10**i for I in range(0,8,2)]
I am trying to generate a tick for every 2 steps. However, the generated plot gives the y-axis ticks every 1 step. What am I doing wrong?
Thanks in advance.