틱의 겹침을 제거하기 위해 x 및 y 축의 크기를 늘리고 싶습니다. 또한이 컴포넌트 라벨링을 수평으로 회전 할 수 있습니다.
다음은 코드입니다.
fg = sns.FacetGrid(data=df, hue='Component',aspect=1.61)
_=plt.grid(which='major', color='#cccccc', alpha=0.45)
_=plt.title('testing', family="Arial", fontsize=12)
_=plt.xlabel("x")
_=plt.ylabel("y")
plt.yticks(AV_df.index,AV_df.Affects_version.values)
scale_factor = 0.1
scale_factorx = 5
ymin, ymax = plt.ylim()
fig= plt.figure(figsize=(3,10))
plt.autoscale(enable=True, axis='x', tight=True)
plt.ylim(ymin * scale_factor, ymax * scale_factor)
fg.map(plt.scatter,'ts','Affects_version').add_legend()
hue
매개 변수 사용을 활성화하기위한 것입니다.scatter
height
및 aspect
매개 변수를 올바르게 설정하는 것이 Figure 크기를 제어하는 핵심입니다.import pandas as pd
import random
import numpy as np
import string
# create synthetic data
np.random.seed(365)
random.seed(365)
data = {'affects': [random.choice(string.ascii_uppercase) for _ in range(10000)],
'ts': [np.random.randint(10, 80) for _ in range(10000)],
'component': [random.choice(string.ascii_lowercase) for _ in range(10000)]}
# create the dataframe
df = pd.DataFrame(data)
# plot
fg = sns.FacetGrid(data=df, hue='component', height=16, aspect=0.8)
fg.map(plt.scatter, 'ts', 'affects').add_legend()
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다