scatter
import pandas as pd
df_train=pd.read_excel(r"C:\Users\Liugengxin\Desktop\回归.xlsx")
Y = '森林火灾次数'
X = '人口'
data = pd.concat([df_train[X], df_train[Y]], axis=1)
data.plot.scatter(x=X, y=Y, ylim=(0,1.2))
boxplot
matlab
a=xlsread('C:\Users\Liugengxin\Desktop\test.xlsx','sheet1');
%x is lable(country,credit) y is value
x=a(:,2)
y=a(:,1)
boxplot(y,x)
python
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
df_train=pd.read_excel(r"C:\Users\Liugengxin\Desktop\课程\数据科学\大作业\原始数据\train.xlsx")
var = 'OverallQual'
data = pd.concat([df_train['SalePrice'], df_train[var]], axis=1)
f,ax = plt.subplots(figsize=(8,6 ))
fig = sns.boxplot(x=var, y="SalePrice", data=data)
fig.axis(ymin=0, ymax=800000);