Để ẩn ký hiệu khoa học trên trục Y factorplot Seaborn/Matplotlib, ta dùng style="plain" trong ticklabel_format().
Các bước
- Thiết lập kích thước hình và điều chỉnh khoảng đệm giữa và xung quanh subplots.
- Tạo dataframe với khóa col1, col2.
- factorplot() đã đổi tên thành catplot().
- Ẩn ký hiệu khoa học dùng style="plain" trong ticklabel_format().
- Hiển thị hình dùng show().
Ví dụ
from matplotlib import pyplot as plt
import pandas as pd
import seaborn as sns
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
df = pd.DataFrame({"col1": [1, 3, 5, 7, 1], "col2": [1, 5, 7, 9, 1]})
sns.catplot(y="col1", x="col2", kind='bar', data=df, label="Total", height=3.5)
plt.ticklabel_format(style='plain', axis='y')
plt.show()
Kết quả
