python 散点图

python 散点图_第1张图片


python 散点图_第2张图片


python 散点图_第3张图片


python 散点图_第4张图片

import pandas

import matplotlib

import matplotlib.pyplot as plt

data = pandas.read_csv(

'D:\\PDA\\6.1\\data.csv'

)

python 散点图_第5张图片

mainColor = (42/256, 87/256, 141/256, 1)

font = {

'size': 20,

'family': 'SimHei'

}

matplotlib.rc('font', **font)

#%matplotlib qt

#plt.grid(True)

#小点

plt.xlabel('广告费用', color=mainColor)#设置坐标轴标签

plt.ylabel('购买用户数', color=mainColor)

plt.tick_params(axis='x', colors=mainColor)#设置坐标轴颜色

plt.tick_params(axis='y', colors=mainColor)

plt.plot(

data['广告费用'],

data['购买用户数'],

'.', color=mainColor

)#小点画图

python 散点图_第6张图片

#大点

plt.xlabel('广告费用', color=mainColor)

plt.ylabel('购买用户数', color=mainColor)

plt.tick_params(axis='x', colors=mainColor)

plt.tick_params(axis='y', colors=mainColor)

plt.plot(

data['广告费用'],

data['购买用户数'],

"o", color=mainColor

)

python 散点图_第7张图片

你可能感兴趣的:(python 散点图)