Skip to content

Commit 2eda248

Browse files
author
Jordan S Read
committed
side naming for log.gsplot
1 parent 262bd77 commit 2eda248

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export(is.gsplot)
2222
export(legend)
2323
export(lines)
2424
export(loadConfig)
25+
export(log)
2526
export(mtext)
2627
export(par)
2728
export(points)

R/access-gsplot.R

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,23 @@ ylim.gsplot <- function(object){
4141
#' @aliases log
4242
#' @name log
4343
#' @rdname log
44-
#' @param x a gsplot object
45-
#' @param base not used
44+
#' @param object a gsplot object
45+
#' @param side which side(s) to use (returns logical)
4646
#' @export
47-
log.gsplot <- function(x,base){
47+
log <- function(object, side) {
48+
if (is.gsplot(object))
49+
UseMethod('log')
50+
base::log(x=object, base=side)
51+
}
52+
53+
#' @export
54+
log.gsplot <- function(x, side=NULL){
55+
names = unname(sapply(views(x), function(x) paste0('side.',paste(x$window$side[1:2],collapse='.'))))
56+
logs = lapply(views(x), function(x) x$window$log) %>%
57+
setNames(names)
4858

49-
lapply(views(x), function(x) x$window$log)
59+
if (!is.null(side)){
60+
warning('not yet implemented. Will return boolean for side matches')
61+
}
62+
return(logs)
5063
}

man/log.Rd

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
% Please edit documentation in R/access-gsplot.R
33
\name{log}
44
\alias{log}
5-
\alias{log.gsplot}
65
\title{log for gsplot}
76
\usage{
8-
\method{log}{gsplot}(x, base)
7+
log(object, side)
98
}
109
\arguments{
11-
\item{x}{a gsplot object}
10+
\item{object}{a gsplot object}
1211

13-
\item{base}{not used}
12+
\item{side}{which side(s) to use (returns logical)}
1413
}
1514
\description{
1615
get the log for views in gsplot object

0 commit comments

Comments
 (0)