평행좌표그림 (Parallel coordinate plots)
입력 필드 X만큼 Y축을 만들고 동일한 행에 있는 값을 선으로 연결하여 그립니다.
from sklearn.datasets import load_iris
from pandas.tools.plotting import parallel_coordinates
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
# Look pretty...
matplotlib.style.use('ggplot')
# If the above line throws an error, use plt.style.use('ggplot') instead
# Load up SKLearn's Iris Dataset into a Pandas Dataframe
data = load_iris()
df = pd.DataFrame(data.data, columns=data.feature_names)
df['target_names'] = [data.target_names[i] for i in data.target]
# Parallel Coordinates Start Here:
plt.figure()
parallel_coordinates(df, 'target_names')
plt.show()
Andrews curve
from sklearn.datasets import load_iris
from pandas.tools.plotting import andrews_curves
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
# Look pretty...
matplotlib.style.use('ggplot')
# If the above line throws an error, use plt.style.use('ggplot') instead
# Load up SKLearn's Iris Dataset into a Pandas Dataframe
data = load_iris()
df = pd.DataFrame(data.data, columns=data.feature_names)
df['target_names'] = [data.target_names[i] for i in data.target]
# Andrews Curves Start Here:
plt.figure()
andrews_curves(df, 'target_names')
plt.show()
'Code > Phyton' 카테고리의 다른 글
Matplotlib / Histogram / 2D & 3D Scatter Plots (0) | 2020.03.03 |
---|---|
Pure Textual Features /scikit-learn/countvectorize (0) | 2020.02.27 |
pandas/Textual Categorical-Features/ordinal/nominal (0) | 2020.02.27 |
파이썬으로 공연예술 검색엔진 만들기 (별첨) (0) | 2019.12.28 |
파이썬으로 공연예술 검색엔진 만들기(3) (0) | 2019.12.28 |