np.arange(a, b, s)
np.sin(value)
plt.legend(loc="위치", label=[범례])
t = np.arange(0, 5, 0.5)
array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5])
plt.figure(figsize=(10,6))
plt.plot(t, t, "r--")
plt.plot(t, t 2, "bs")
plt.plot(t, t 3, "g^")
plt.show
t = [0, 1, 2, 3, 4, 5, 6]
t = list(range(0, 7))
y = [1, 4, 5, 8, 9 ,5, 3]
plt.figure(figsize=(10,6))
plt.plot(
t,
y,
color="green",
linestyle="dashed",
marker="o",
markerfacecolor="blue",
markersize=15,
)
plt.xlim([-0.5, 6.5])
plt.ylim([0.5, 9.5])
plt.show()
t = np.array(range(0, 10))
y = np.array([9, 8, 7, 9, 8, 3, 2, 4, 3, 4])
plt.figure(figsize=(10,6))
plt.scatter(t, y)
plt.grid(True)
plt.show()
data_result["소계"].sort_values().plot(kind="barh", figsize=(10,10), grid=True);
def drawGraph():
plt.figure(figsize=(14, 10))
plt.scatter(data_result["인구수"], data_result["소계"], s=50)
plt.xlabel("인구수")
plt.ylabel("CCTV")
plt.grid(True)
plt.show()
drawGraph()
fp1 = np.polyfit(data_result["인구수"], data_result["소계"], 1)
f1 = np.poly1d(fp1)
fx = np.linspace(100000, 700000, 100)
def drawGraph():
plt.figure(figsize=(14, 10))
plt.scatter(data_result["인구수"], data_result["소계"], s=50)
plt.plot(fx, f1(fx), ls="dashed", lw=3, color="g")
plt.xlabel("인구수")
plt.ylabel("CCTV")
plt.grid(True)
plt.show()
drawGraph()
def drawGraph():
plt.figure(figsize=(14, 10))
plt.scatter(data_result["인구수"], data_result["소계"], s=50, c=data_result["오차"], cmap=my_cmap)
plt.plot(fx, f1(fx), ls="dashed", lw=3, color="g")
for i in range(5):
#상위 5개
plt.text(
df_sort_f["인구수"][i] * 1.02,
df_sort_f["소계"][i] * 0.98,
df_sort_f.index[i],
fontsize=15,
)
#하위 5개
plt.text(
df_sort_t["인구수"][i] * 1.02,
df_sort_t["소계"][i] * 0.98,
df_sort_t.index[i],
fontsize=15
)
plt.text(df_sort_f["인구수"][0] * 1.02, df_sort_f["소계"][0] * 0.98, df_sort_f.index[0], fontsize=15)
plt.xlabel("인구수")
plt.ylabel("CCTV")
plt.colorbar()
plt.grid(True)
plt.show()
drawGraph()