如何用2个海底图(子图)创建一个图?
如何将2个海洋地块合并为1个?
plt.figure(figsize = (12, 6))
ax = sns.scatterplot(x = model1.fittedvalues, y = model1.resid)
plt.grid()
ax.axhline(y=0, color='r', linewidth=4)
ax.set_xlabel("vysvětlovaná proměnná");
ax.set_ylabel("residua");
plt.figure(figsize = (12, 6))
ax = sns.distplot(a = model1.resid, bins = 40, norm_hist=True,)
plt.grid()
ax.set_title("Histogram reziduí", fontsize = 25);
答案 0 :(得分:0)
您可以根据自己的喜好创建子图(使用plt.subplots()
,fig.add_subplot()
,GridSpec
命名),然后使用{{ 1}}
ax=<your axes reference>
答案 1 :(得分:0)
您最好定义子图:
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
x = np.array([4,3,2,3])
y = np.array([5,1,6,4])
**fig, sub = plt.subplots(2,1)**
plt.figure(figsize = (12, 6))
sns.scatterplot(x, y , **ax=sub[0]**)
ax.axhline(y=0, color='r', linewidth=4)
ax.set_xlabel("vysvětlovaná proměnná")
ax.set_ylabel("residua")
plt.figure(figsize = (12, 6))
sns.distplot(x, bins = 40, norm_hist=True, **ax=sub[1]**)
ax.set_title("Histogram reziduí", fontsize = 25)