[英]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.