练习1
为了对某一产品进行合理定价,我们对此类商品进行了试销实验,价格与需求量数据如下。利用图表分析规律。
price = [60,80,40,30,70,90,95]
sales = [100,50,120,135,65,45,40]
解答:
from matplotlib import pyplot as plt
import matplotlib
font = {
'family':'SimHei',
'weight':'bold',
'size':12
}
matplotlib.rc("font", **font)
plt.figure(figsize=(14,8))
# 构建x、y
x_price = [60,80,40,30,70,90,95]
y_sales = [100,50,120,135,65,45,40]
# 绘图
plt.sca