'21/12/17æ´æ°ï¼ã«ãã´ãªã®èå¥ãè²ã§ãªãã¦ããã¼ã«ã¼ã§ããå ´åã®éå½¢ã³ã¼ãã追è¨ãã¾ããã
ãæ¬è¨äºã§ã¯ãä¸å³ã®ãããªæ£å¸å³ãä½æããéå½¢ã³ã¼ããè¼ãã¾ãããseabornã®pairplotãç¨ãã¾ãã
Y軸ã®ååãæå®ããã«ã¯ä¸è¨ã®ããã«ãã¾ãã
y_vars = 'PRICE',
Y軸ã®ç¯å²ã¯ä¸è¨ã®ããã«è¨å®ãã¾ãã
ax.set(ylim=(0, 60))
Â
â æ¬ããã°ã©ã
import pandas as pd
df = pd.read_csv('boston_dataset.csv')
df
from matplotlib import pyplot as plt
import seaborn as sns
x_name_list = ['CRIM', 'INDUS', 'RM', 'PTRATIO', 'LSTAT']
y_name = 'PRICE'
sns.set_context('talk')
ax = sns.pairplot(
df,
x_vars = x_name_list,
y_vars = y_name,
hue = 'CHAS',
palette = 'gnuplot2',
kind = 'reg',
markers = '.',
diag_kind = 'kde',
diag_kws = dict(shade = True),
height = 3,
aspect = 3/4
)
ax.set(ylim=(0, 60))
ax.fig.suptitle('boston data set', y = 1.0)
plt.subplots_adjust(left=0.1, right=0.9, bottom=0.3, top=0.85)
plt.savefig('Boston.jpg'
ã¡ãªã¿ã«ãä¸å³ã®ããã«è¿ä¼¼å¼ãå
¥ããã«ãã«ãã´ãªããã¼ã«ã¼ã§èå¥ããå ´åã®éå½¢ã³ã¼ãã¯æ¬¡ã®éãã§ããç¹è¨±åºé¡ã®éãªã©ã§ç½é»ã§ããå¿
è¦ã®å ´åã«ä½¿ãã¾ãã
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_context('talk')
ax = sns.pairplot(
df,
x_vars = ['x1', 'x2', 'x3'],
y_vars = 'stress',
hue = 'label',
palette = 'Greys',
markers = ['o', 'X', '^'],
  plot_kws = {'s':100,
'linewidth':0.5,
'edgecolor':'k'}
)
ax.set(ylim=(0, 350))
以ä¸
<åºå>
ãªã³ã¯