[英]Changing granularity of ticks in Seaborn lineplot on x-axis
这实际上是通过 Matplotlib 更改的,因为 Seaborn 是围绕它的一种包装器。
此外, sns.lineplot
返回matplotlib.axes._subplots.AxesSubplot
object。
这是你可以做的
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
loc = plticker.MultipleLocator(base=7.0) # To put a tick every seven days
# plt.figure(figsize=(15, 6)) # to change the size of the graph
# plt.title(f"Some super title")
# plt.ylabel("% active cases") # if you want to add a label in y-axis
axes = sns.lineplot(data=to_plot.loc[REF_DATE:])
axes.xaxis.set_major_locator(loc)
结果可能如下所示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.