Commit 889d62ea authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

plotMortalityTableComparison / plotMortalityTrend: Add legend.title argument

parent 6ba1d2d7
...@@ -31,6 +31,7 @@ plotMortalityTableComparisons = function( ...@@ -31,6 +31,7 @@ plotMortalityTableComparisons = function(
xlab = NULL, ylab = NULL, xlab = NULL, ylab = NULL,
title = "", title = "",
legend.position = c(0.9,0.1), legend.justification = c(1, 0), legend.position = c(0.9,0.1), legend.justification = c(1, 0),
legend.title = "Sterbetafel",
legend.key.width = unit(25, "mm"), legend.key.width = unit(25, "mm"),
reference = NULL) reference = NULL)
{ {
...@@ -85,7 +86,7 @@ plotMortalityTableComparisons = function( ...@@ -85,7 +86,7 @@ plotMortalityTableComparisons = function(
) + ) +
# annotation_logticks(sides="lr") + # annotation_logticks(sides="lr") +
xlab("Alter") + labs(colour="Sterbetafel"); xlab("Alter") + labs(colour = legend.title);
if (title != "") { if (title != "") {
pl = pl + ggtitle(title); pl = pl + ggtitle(title);
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#' @param legend.position The position of the legend (default is \code{c(0.9,0.1)}) #' @param legend.position The position of the legend (default is \code{c(0.9,0.1)})
#' @param legend.justification The justification of the legend (default is \code{c(1,)}) #' @param legend.justification The justification of the legend (default is \code{c(1,)})
#' @param legend.key.width The keywith of the lines in the legend (default is \code{unit(25,"mm")}) #' @param legend.key.width The keywith of the lines in the legend (default is \code{unit(25,"mm")})
#' @param legend.title Title of the legend #' @param legend.title Title of the legend (\code{NULL} to hide)
#' @param ages Plot only the given ages #' @param ages Plot only the given ages
#' #'
#' @examples #' @examples
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#' @param title The plot title #' @param title The plot title
#' @param legend.position The position of the legend (default is \code{c(0.9,0.1)}) #' @param legend.position The position of the legend (default is \code{c(0.9,0.1)})
#' @param legend.key.width The keywith of the lines in the legend (default is \code{unit(25,"mm")}) #' @param legend.key.width The keywith of the lines in the legend (default is \code{unit(25,"mm")})
#' @param legend.title Title of the legend (\code{NULL} to hide)
#' #'
#' @examples #' @examples
#' # Load the Austrian aunnity data #' # Load the Austrian aunnity data
...@@ -40,7 +41,7 @@ plotMortalityTrend = function( ...@@ -40,7 +41,7 @@ plotMortalityTrend = function(
xlim=NULL, ylim=NULL, xlim=NULL, ylim=NULL,
xlab=NULL, ylab=NULL, xlab=NULL, ylab=NULL,
title = "", title = "",
legend.position=c(0.9, 0.9), legend.justification = c(1, 1), legend.position=c(0.9, 0.9), legend.justification = c(1, 1), legend.title = "Sterbetafel",
legend.key.width = unit(25, "mm") legend.key.width = unit(25, "mm")
) { ) {
...@@ -81,7 +82,7 @@ plotMortalityTrend = function( ...@@ -81,7 +82,7 @@ plotMortalityTrend = function(
) + ) +
coord_cartesian(xlim = xlim, ylim = ylim) + coord_cartesian(xlim = xlim, ylim = ylim) +
annotation_logticks(sides = "lr") + annotation_logticks(sides = "lr") +
xlab("Alter") + labs(colour = "Sterbetafel"); xlab("Alter") + labs(colour = legend.title);
if (title != "") { if (title != "") {
pl = pl + ggtitle(title); pl = pl + ggtitle(title);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment