Seaborn regplot에서 점과 선에 대해 다른 색상을 표시하려면 다음 단계를 수행할 수 있습니다. -
-
Figure 크기를 설정하고 서브플롯 사이와 주변의 패딩을 조정합니다.
-
X축과 Y축 키를 사용하여 Pandas 데이터 프레임을 만듭니다.
-
회귀 모델을 사용하여 숫자 독립 변수를 플로팅합니다.
-
그림을 표시하려면 show()를 사용하세요. 방법.
예시
import pandas
import matplotlib.pylab as plt
import seaborn as sns
import numpy as np
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
df = pandas.DataFrame({"X-Axis": [np.random.randint(5) for i in range(10)], "Y-Axis": [np.random.randint(5) for i in range(10)]})
sns.regplot(x='X-Axis', y='Y-Axis', data=df, scatter_kws={"color": "red"}, line_kws={"color": "green"})
plt.show() 출력
