Python

简介: 两种画图的实例

import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['font.family'] = 'SimHei'
matplotlib.rc('figure', figsize=(20, 5))
p1 = plt.bar(df["TradeDate"],df["Total price"], width=0.5)
plt.title("房价与年份的关系",size=30)
plt.xlabel("x")
plt.ylabel("y")
plt.show()
image.png
import matplotlib.pyplot as plt
import pandas as pd

plt.scatter(df["Total price"], df["Total price"], c=color[1], edgecolors='r')
plt.xlim(0,10000)
plt.ylim(0,10000)
plt.title("房价分析")
plt.xlabel("x")
plt.ylabel("y")
plt.show()
image.png
import matplotlib.pyplot as plt
def bar1():
price=[1000,2500,6000,6000,9000]
plt.bar(np.arange(5),price,align='center',color='green',alpha=1.0)
plt.xticks(np.arange(5),["北京","武汉","石家庄","唐山","秦皇岛"])
plt.title(r"price")
plt.ylabel("price(W)")
bar1()
image.png

目录
打赏
0
0
0
0
0
分享
相关文章
|
11月前
|
Python懒羊羊
Python懒羊羊
184 0
|
8月前
|
Python 中的 self 是什么?
【8月更文挑战第29天】
899 5
python中的常用小技巧
python中的常用小技巧
157 0

热门文章

最新文章