Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

legend.grob parameterize legend title y-position #199

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: BoutrosLab.plotting.general
Version: 7.1.2
Version: 7.1.3
Type: Package
Title: Functions to Create Publication-Quality Plots
Date: 2024-10-02
Date: 2024-10-09
Authors@R: c(person("Paul Boutros", role = c("aut", "cre"), email = "[email protected]"),
person("Christine P'ng", role = "ctb"),
person("Jeff Green", role = "ctb"),
Expand All @@ -17,7 +17,8 @@ Authors@R: c(person("Paul Boutros", role = c("aut", "cre"), email = "PBoutros@me
person("Stefan Eng", role = "ctb"),
person("Mohammed Faizal Eeman Mootor", role = "ctb"),
person("Rachel Dang", role = "ctb"),
person("John Sahrmann", role = "ctb"))
person("John Sahrmann", role = "ctb"),
person("Jaron Arbet", role = "ctb"))
Maintainer: Paul Boutros <[email protected]>
Depends: R (>= 3.5.0), lattice (>= 0.20-35), latticeExtra (>= 0.6-27), cluster (>= 2.0.0), hexbin (>= 1.27.0), grid
Imports: gridExtra, tools, methods, gtable, e1071, MASS(>= 7.3-29)
Expand All @@ -32,4 +33,4 @@ BugReports: https://github.com/uclahs-cds/package-BoutrosLab-plotting-general/is
LazyLoad: yes
LazyData: yes
VignetteBuilder: knitr
Config/testthat/edition: 3
Config/testthat/edition: 3
5 changes: 4 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
BoutrosLab.plotting.general 7.1.3 2024-10-09

UPDATE
* Parameterized `title.y.coord` in `legend.grob` to control y-position of legend title


--------------------------------------------------------------------------
BoutrosLab.plotting.general 7.1.2 2024-09-06

UPDATE
Expand Down
4 changes: 2 additions & 2 deletions R/legend.grob.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

### FUNCTION TO CREATE A LEGEND GROB ###############################################################
legend.grob <- function(
legends, label.cex = 1, title.cex = 1, title.just = 'centre', title.fontface = 'bold',
legends, label.cex = 1, title.cex = 1, title.just = 'centre', title.fontface = 'bold', title.y.coord = 1,
font.family = NULL, size = 3, border = NULL, border.padding = 1, layout = c(1, length(legends)),
between.col = 1, between.row = 1, use.legacy.settings = FALSE, x = 0.5, y = 0.5, background.col = 'white', background.alpha = 0
) {
Expand Down Expand Up @@ -104,7 +104,7 @@ legend.grob <- function(
label = legendi[['title']],
just = c(title.just, 'top'),
x = title.x.coord,
y = 1,
y = title.y.coord,
gp = gpar(
cex = title.cex,
fontface = title.fontface,
Expand Down
1 change: 1 addition & 0 deletions man/legend.grob.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The 'colours' component is a vector of fill colours to be used for the rectangle
\item{title.cex}{Size of titles in the legends, defaults to 1.}
\item{title.just}{Justification of titles in the legends. Defaults to 'centre'.}
\item{title.fontface}{Font face of titles in the legends ('plain', 'bold', 'italic', etc.)}
\item{title.y.coord}{Vertical position of title. Set to 1 for normal position, increase values >1 to raise the title higher.}
\item{font.family}{Font to be used for legend text. If NULL, the default font is used.}
\item{size}{Width of the legend boxes in 'character' units. If a 'size' argument is specified for a legend component, it will override this value.}
\item{border}{A list of parameters (passed to \code{gpar}) specifying line options for the legend border. If NULL, no border is drawn.}
Expand Down
Loading