1
我使用seaborn繪製熱圖。但是如果有太多的yticks,其中一些會自動隱藏。其結果是這樣的:
如果有太多yticks,Seaborn自動隱藏yticks
正如你所看到的,yticks只顯示1,3,5,7 .... 31,33 我怎樣才能讓seaborn或matplotlib全部顯示出來,如:1 ,2,3,4 ..... 31,32,33,34?
我的代碼是:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
y = np.random.randint(1, 100, 510)
y = y.reshape((34,15))
df = pd.DataFrame(y, columns=[x for x in 'wwwwwwwwwwwwwww'], index=['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34'])
sns.heatmap(df, annot=True)
plt.yticks(rotation=0)
plt.show()
非常感謝你。這對我來說可以! – sunnwmy