다음 기본 구문을 사용하여 R의 두 벡터를 비교할 수 있습니다. #check if two vectors are identical identical(vector_1, vector_2) #display items that are in both vectors intersect(vector_1, vector_2) #display items that are only in first vector, but not in second vector setdiff(vector_1,...
R의 par() 함수를 사용하여 한 번에 여러 플롯을 만들 수 있습니다. 이 함수는 다음 기본 구문을 사용합니다. #define plot area as four rows and two columns by(mfrow = c(4, 2)) #create plots plot(1:5) plot(1:20) ... 다음 예에서는 이 기능을 실제로 사용하는...
다음 구문을 사용하여 Matplotlib에서 플롯 눈금 레이블의 글꼴 크기를 설정할 수 있습니다. import matplotlib. pyplot as plt #set tick labels font size for both axes plt. tick_params (axis=' both ', which=' major ', labelsize= 20 ) #set tick labels font size...
다음 구문을 사용하여 Matplotlib에서 플롯의 축 범위를 정의할 수 있습니다. #specify x-axis range plt. xlim (1, 15) #specify y-axis range plt. ylim (1, 30) 다음 예에서는 이 구문을 실제로 사용하는 방법을 보여줍니다. 예 1: 두 축의 범위 지정 다음 코드는 두...
다음 구문을 사용하여 Matplotlib의 플롯에 제목을 추가할 수 있습니다. plt. title (' MyTitle ') 다음 예에서는 이 구문을 실제로 사용하는 방법을 보여줍니다. 예 1: 플롯에 제목 추가 다음 코드는 Matplotlib의 플롯에 제목을 추가하는 방법을 보여줍니다. import matplotlib. pyplot as plt #define...
다음 구문을 사용하여 Matplotlib에서 하위 그림의 크기를 조정할 수 있습니다. #specify one size for all subplots fig, ax = plt. subplots (2, 2, figsize=(10,7)) #specify individual sizes for subplots fig, ax = plt. subplots (1, 2, gridspec_kw={' width_ratios ': [3, 1]})...
다음 구문을 사용하여 Matplotlib의 각 축에 대한 틱 수를 변경할 수 있습니다. #specify number of ticks on x-axis plt. locator_params (axis=' x ', nbins= 4 ) #specify number of ticks on y-axis plt. locator_params (axis=' y ', nbins= 2 ) nbins...
다음 구문을 사용하여 Pandas DataFrame에서 셀 값을 가져올 수 있습니다. #iloc method df. iloc [0][' column_name '] #atmethod df. at [0, ' column_name '] #values method df[' column_name ']. values [0] 세 가지 메서드 모두 동일한 값을 반환합니다. 다음 예에서는 다음...
다음 방법 중 하나를 사용하여 Matplotlib 플롯에서 제목 위치를 조정할 수 있습니다. #adjust title position using 'loc' argument (left, center, right) plt. title (' My Title ', loc=' right ') #adjust title position using x and y coordinates plt. title ('...