Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
legTools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leg
legTools
Commits
a4afb583
Commit
a4afb583
authored
9 years ago
by
Walmes Zeviani
Browse files
Options
Downloads
Patches
Plain Diff
Add yscale.components.right, this allows right axis annotation in lattice plots.
parent
ec22e249
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
R/yscale.components.right.R
+56
-0
56 additions, 0 deletions
R/yscale.components.right.R
with
56 additions
and
0 deletions
R/yscale.components.right.R
0 → 100644
+
56
−
0
View file @
a4afb583
#' @title y-axis annotations on the right side
#'
#' @name yscale.components.right
#'
#' @description This function if for place y axis annotation on the
#' right side of the plot.
#'
#' @param ... arguments passed by the lattice function called. See
#' \link[lattice]{yscale.components.default}.
#'
#' @import lattice latticeExtra
#'
#' @source When such feature was necessary, a search in the web was done
#' and a post in the r-help mailing list inspired us
#' \code{http://r.789695.n4.nabble.com/Spacing-between-lattice-panels-td855613.html}.
#'
#' @author Walmes Zeviani, \email{walmes@@ufpr.br}
#'
#' @export
#'
#' @examples
#'
#' library(lattice)
#' library(latticeExtra)
#'
#' ## alternating=2 works when relation="same".
#' p1 <- xyplot(yield~K|N+P, data=npk,
#' scales=list(y=list(alternating=2)))
#' useOuterStrips(p1)
#'
#' ## y annotation don't is written on the right side.
#' p2 <- xyplot(yield~K|N+P, data=npk,
#' scales=list(y=list(relation="free", alternating=2)))
#' useOuterStrips(p2)
#'
#' ## The desired result.
#' p3 <- xyplot(yield~K|N+P, data=npk,
#' scales=list(y=list(relation="free", alternating=2)),
#' ylab=NULL, ylab.right="Yield",
#' yscale.component=yscale.component.right,
#' between=list(x=0.5, y=0.2),
#' par.settings=list(
#' layout.widths=list(
#' right.padding=-2,
#' left.padding=-2,
#' ylab.right=5),
#' strip.background=list(col=c("gray50", "gray90"))),
#' )
#' useOuterStrips(p3)
#'
yscale.component.right
<-
function
(
...
){
ans
<-
yscale.components.default
(
...
)
ans
$
right
<-
ans
$
left
ans
$
left
<-
NULL
ans
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment