多变量的绘制
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import integrate, stats
import seaborn as sns
sns.set(style="whitegrid",color_codes=True)
tips=sns.load_dataset("tips")
iris=sns.load_dataset("iris")
np.random.seed(sum(map(ord,"axis_grids")))
from pandas import Categorical
ordered_days=tips.day.value_counts().index
print(ordered_days)
with sns.axes_style("white"):
g=sns.FacetGrid(tips,row="sex",col="smoker",margin_titles=True,
size=2.5)
g.map(plt.scatter,"total_bill","tip",color="#334488",
edgecolor="white",lw=0.5)
g.set_axis_labels("Total bill (US Dollars)","Tip")
g.set(xticks=[10,30,50],yticks=[2,6,10])
g.fig.subplots_adjust(wspace=0.02,hspace=0.02)
plt.show()
制定类别
sns.set(style="whitegrid",color_codes=True)
tips=sns.load_dataset("tips")
iris=sns.load_dataset("iris")
g=sns.PairGrid(iris,vars=["sepal_length","sepal_width"],
hue="species")
g.map(plt.scatter)
plt.show()