001、基礎繪圖
library(ggplot2)#匯入ggplot包 ggplot(data = mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point() + theme_bw() ## 基礎繪圖
002、設定x軸名稱與框線的距離
a、設定為5
library(ggplot2)#匯入ggplot包 ggplot(data = mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point() + theme_bw() + theme(axis.title.x = element_text(vjust = 5)) ## 設定x軸名稱與框線的距離,vertical設定為5
b、設定為-3
library(ggplot2)#匯入ggplot包 ggplot(data = mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point() + theme_bw() + theme(axis.title.x = element_text(vjust = -3)) ## 設定為-3
004、測試y軸
a、設定為5
library(ggplot2)#匯入ggplot包 ggplot(data = mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point() + theme_bw() + theme(axis.title.y = element_text(vjust = 5)) ## 設定為5
b、設定為-5
library(ggplot2)#匯入ggplot包 ggplot(data = mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point() + theme_bw() + theme(axis.title.y = element_text(vjust = -5)) ## 設定為-5
。