1.代码:
import pandas as pd from matplotlib import pyplot as plt import seaborn as sns # 读入数据 file = r'123.xlsx' sheet = 'test' # 标题名称 xlabel = '供订比' ylabel = '订货量' data = pd.read_excel(file, sheet_name=sheet) #处理中文乱码 plt.rcParams['font.sans-serif'] = ['Microsoft YaHei'] sns.jointplot(data=data, x="订供比", y="对应的订货") plt.yscale('log') # 设置纵坐标为对数刻度 plt.xlabel(xlabel) plt.ylabel(ylabel) plt.show()
修改文件名、表单名、jointplot里的x和y
2.效果: