-
Notifications
You must be signed in to change notification settings - Fork 0
/
djhc_bch3.py
79 lines (66 loc) · 1.64 KB
/
djhc_bch3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# DESCRIPTION : 3장 연습문제
# -*- coding: utf-8 -*-
from matplotlib import font_manager, rc
import pandas as pd
from pandas.core.groupby.groupby import DataError
import math as m
from matplotlib import pyplot as plt
import seaborn as sns
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
# 2번
x = np.arange(0, 6)
y1 = x
y2 = x * x
y3 = np.log(x + 1)
y4 = np.sqrt(x)
plt.figure(figsize=(8, 3))
plt.scatter(x, y1, color="red")
plt.plot(x, y2, color="orange")
plt.plot(x, y3, color="yellow", linestyle='-.')
plt.plot(x, y4, color="green", linestyle='--')
plt.legend(labels=('y1', 'y2', 'y3', 'y4'), loc='upper left')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
# 5번
x = np.linspace(-3, 3, 100)
y = (1 / np.sqrt(2 * np.pi)) * np.exp(-x**2 / 2)
plt.figure(figsize=(8, 2))
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('y')
plt.grid()
plt.title("Standard Normal Distribution")
plt.legend(["N(0,1)"])
y2 = np.exp(-np.abs(x))
plt.plot(x, y2, color="orange")
plt.show()
# 10번
iris = sns.load_dataset("iris")
iris.head()
iris.mean(axis=0)
iris.groupby("species").mean()
st = iris.groupby(iris.species).mean()
print(st)
st.T.plot.bar(rot=0)
plt.title("variable mean of species")
plt.xlabel("variables")
plt.ylabel("mean")
plt.show()
# 한글 폰트 체크
font_name = font_manager.FontProperties(fname='ONE Mobile Bold.ttf').get_name()
plt.rc('font', family=font_name)
# 5번
x = np.linspace(-3, 3, 100)
y = (1 / np.sqrt(2 * np.pi)) * np.exp(-x**2 / 2)
plt.figure(figsize=(8, 2))
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('y')
plt.grid()
plt.title("스탠다드노멀")
plt.legend(["N(0,1)"])
y2 = np.exp(-np.abs(x))
plt.plot(x, y2, color="orange")
plt.show()