是否可以抑制标签 cowplot 包 R

Is it possible to suppress label cowplot package R

我想知道是否可以使用 cowplot 包抑制 (x - top: "mpg") 和 (y - right: "wt") 处的轴标签。

library(ggplot2); library(cowplot)  
plot_a <- ggplot(mtcars, aes(mpg,wt)) + geom_point()  
ggdraw(switch_axis_position(plot_a, axis = 'xy',keep = 'xy'))

谢谢!

看这里:https://rdrr.io/cran/cowplot/man/panel_border.html

ggdraw 行替换为: plot+panel_border(colour="black", size=0.5, linetype=1,remove=FALSE)

你可以

# devtools::install_github("hadley/ggplot2")
# packageVersion("ggplot2")
# # [1] ‘2.1.0.9001’

library(ggplot2)
ggplot(mtcars, aes(mpg,wt)) + 
  geom_point() + 
  scale_x_continuous(sec.axis = sec_axis(~ .)) + 
  scale_y_continuous(sec.axis = sec_axis(~ .)) + 
  cowplot::theme_cowplot()

查看 ggplot2 2.2.0 上的注释。