Closed malcolmbarrett closed 5 years ago
Merging #111 into master will increase coverage by
14.51%
. The diff coverage is69.56%
.
@@ Coverage Diff @@
## master #111 +/- ##
===========================================
+ Coverage 51.64% 66.16% +14.51%
===========================================
Files 13 16 +3
Lines 697 733 +36
===========================================
+ Hits 360 485 +125
+ Misses 337 248 -89
Impacted Files | Coverage Δ | |
---|---|---|
R/get_legend.R | 100% <100%> (ø) |
:arrow_up: |
R/get_titles.R | 100% <100%> (ø) |
|
R/get_axes.R | 100% <100%> (ø) |
|
R/get_panel.R | 47.36% <47.36%> (-52.64%) |
:arrow_down: |
R/get_plot_component.R | 80% <80%> (ø) |
|
R/themes.R | 98.9% <0%> (+8.02%) |
:arrow_up: |
R/plot_grid.R | 95.41% <0%> (+38.16%) |
:arrow_up: |
... and 1 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 374c3e9...fa94c73. Read the comment docs.
Great, I'll make those changes next week. Overall, is it agreeable enough that I devote some time to fleshing out the documentation?
Yes, please go ahead.
Please also add a bullet point to NEWS, with your github user name and PR number, as explained in the tidyverse style guide: http://style.tidyverse.org/news.html#acknowledgement
Ok: made those changes, expanded docs, and added some tests. Not sure what's up with the Travis build. A quick look doesn't look like it's related to changes, but not sure why it would suddenly fail on this branch...
All added. I think the Travis thing was a one-off upstream change on a distant remote repo (some r-lib upstream dependency) that already got fixed there.
Thanks!
Thanks, @clauswilke!
This PR expands cowplot's functionality for extracting plot components. Closes #110.
The main addition is
get_plot_component()
, which extracts grobs from a ggplot by matching a pattern to the grob names. I've added several wrappers for axes and titles and added a couple functions for getting component names (plot_component_names()
) and quickly extracting the whole list of grobs (plot_components()
). I've also rewrittenget_legend()
andget_panel()
to useget_plot_components()
.get_legend()
works the same way, butget_panel()
can now also specify a panel in a faceted plot.I avoided the issue of pulling a list of grobs because both
+
and (by extension)ggdraw()
have trouble with them. It would probably be possible to makeggdraw()
support that, but it also doesn't really know how to put them back together. One option for pulling all facet panels is a function that puts them into a gtable, as I believe is done internally in ggplot2.This needs a little cleaning up and better documentation before it's a proper PR, but I'd thought I'd better check with you before I put that work in.
Here's a demo of the new/rewritten functions:
Created on 2018-10-13 by the reprex package (v0.2.0).