【发布时间】:2018-09-20 06:43:06
【问题描述】:
我尝试从ggplot 对象中提取面板的宽度和高度。到目前为止我做了什么:
library(ggplot2)
library(gtable)
# Create object
p <- ggplot(iris, aes(x = Sepal.Length)) +
geom_histogram()
# Convert the plot to a grob
gt <- ggplotGrob(p)
# Extract panel
panel <- gtable_filter(gt, "panel")
现在我忙于提取正确的尺寸。知道如何进行吗?
【问题讨论】: