import matplotlib.pyplot as plt import numpy as np import pandas as pd

#무작위 분포 n = 100 #분포개수

x = np.random.rand(n) y = np.random.rand(n) #x y 의 n값동일해야함

plt.scatter( x, y, s= 10, c='#a37ff1', marker = 'D') #축, 색, 마커모양 plt.title('random') plt.show()

#그래프 x = np.arange(0, 10, 0.5) y = np.linspace(0, 100, 1) plt.plot(x, xx, 'b*',x, -x*2+10, 'r', y, y, '+') #하양 그래프는np.arange(10, 0, -1)이런식으로 만들어짐X plt.plot(x, x3, color='forestgreen', marker='^', markersize=9) plt.axis([0,20,0,20]) #축 크기 plt.grid(True) plt.title('graph') plt.show()

#bar

ind = np.arange(1, 8, 2) #x값 y = [6, 4, 2, 1] #높이 colors = ['brown', 'red', 'skyblue', 'orange'] plt.bar(ind, y, width = 0.3, bottom = -1, color = colors) #bottom 최저점 #너비 plt.title('bar') plt.grid(True) plt.show()

#pie

labels = ['A', 'B', 'C', 'D'] sizes = [20, 20, 50, 10] explode = [0, 0, 0.1, 0] #강조 colors = ['brown', 'red', 'skyblue', 'orange']

plt.pie( sizes, labels = labels, autopct = '%1.1f%%', startangle = 90, colors = colors, shadow = True, explode = explode) plt.title('pie')

plt.show()

#그래프 동시 표현 plt.subplot(row, column, index)