전체 가이드: base r 플롯에서 글꼴 크기를 변경하는 방법


다음 구문을 사용하여 기본 R 플롯에서 다양한 요소의 글꼴 크기를 변경할 수 있습니다.

 plot(df$x, df$y, main=' Title ', sub=' Subtitle ',
     cex.main= 2 , #change font size of title
     cex.sub= 2 , #change font size of subtitle
     cex.lab= 2 , #change font size of axis labels
     cex.axis= 2 ) #change font size of axis text  

다음 예에서는 기본 R의 다음 포인트 클라우드와 함께 이 구문을 사용하는 방법을 보여줍니다.

 #create data frame
df <- data. frame (x=c(1, 2, 3, 4, 5, 6),
                 y=c(5, 8, 12, 16, 25, 33))

#create scatterplot with all default font sizes
plot(df$x, df$y, main=' Title ', sub=' Subtitle ')

예 1: 제목 글꼴 크기 변경

다음 코드는 플롯 제목의 글꼴 크기를 변경하는 방법을 보여줍니다.

 #create scatterplot with increased font size of title
plot(df$x, df$y, main=' Title ', sub=' Subtitle '.
     cex.main= 2 ) 

예시 2: 자막 글꼴 크기 변경

다음 코드는 플롯 자막의 글꼴 크기를 변경하는 방법을 보여줍니다.

 #create scatterplot with increased font size of subtitle
plot(df$x, df$y, main=' Title ', sub=' Subtitle '.
     cex.sub= 2 ) 

예 3: 축 레이블의 글꼴 크기 변경

다음 코드는 플롯 축 레이블의 글꼴 크기를 변경하는 방법을 보여줍니다.

 #create scatterplot with increased font size of axis labels
plot(df$x, df$y, main=' Title ', sub=' Subtitle '.
     cex.lab= 2 ) 

예 4: 축 텍스트의 글꼴 크기 변경

다음 코드는 플롯 축 텍스트의 글꼴 크기를 변경하는 방법을 보여줍니다.

 #create scatterplot with increased font size of axis text
plot(df$x, df$y, main=' Title ', sub=' Subtitle '.
     cex.axis= 2 ) 

추가 리소스

다음 튜토리얼에서는 R에서 다른 일반적인 추적 작업을 수행하는 방법을 설명합니다.

R의 플롯에 위 첨자와 아래 첨자를 추가하는 방법
ggplot2 플롯에서 글꼴 크기를 변경하는 방법
R에서 이탤릭체 글꼴을 사용하는 방법

의견을 추가하다

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다