R: Remove main title, left axis tick labels, left strip, bottom...
emptyMainLeftAxisLeftStripBottomLegend
R Documentation
Remove main title, left axis tick labels, left strip, bottom legend
from plot and keep the vertical spacing allocated to those items.
Description
Remove main title, left axis tick labels, left strip, bottom legend from
plot and keep the vertical spacing allocated to those items. This
function is used to prepare a trellis object to be placed next to
another trellis object. The current object will have much of its
annotation
removed with the intent of sharing annotation with the other object.
This is motivated by the ProfChal example in plot.likert.
Usage
emptyMainLeftAxisLeftStripBottomLegend(x)
Arguments
x
A "trellis" object.
Details
We manipulate the items inside the trellis object.
Value
A "trellis" object with the stated items replaced by non-printing
values. The vertical spacing of the original object is retained.
Author(s)
Richard M. Heiberger <rmh@temple.edu>
References
The manipulations are similar to those in the
c.trellis and related functions in the
latticeExtra package.
See Also
plot.likert
Examples
## This is a small example.
## See ?plot.likert for the complete example including motivation.
##
require(grid)
require(lattice)
require(latticeExtra)
require(HH)
data(ProfChal)
tmp <- data.matrix(ProfChal[,1:5])
rownames(tmp) <- ProfChal$Question
ProfChal.list <- split.data.frame(tmp, ProfChal$Subtable)
Empl <- ProfChal.list[[2]]
pct <- likert(Empl, as.percent="noRightAxis", xlab="Percent")
pct
count <- likert(Empl, rightAxis=TRUE,
xlab="Count", ylab.right="Row Count Totals",
scales=list(x=list(at=c(0, 100, 200))))
count
countEmptied <- HH:::emptyMainLeftAxisLeftStripBottomLegend(count)
countEmptied
tmp <- update(resizePanels(c(pct, countEmptied, y.same=TRUE, layout=c(2,1)), w=c(.8, .2)),
scales=list(y=list(alternating=3, limits=count$y.limits),
x=list(at=list(pct$x.scales$at, count$x.scales$at),
labels=list(pct$x.scales$labels,
count$x.scales$labels))),
xlab=c(" ", pct$xlab, " ", count$xlab),
between=list(x=1))
tmp
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(HH)
Loading required package: lattice
Loading required package: grid
Loading required package: latticeExtra
Loading required package: RColorBrewer
Loading required package: multcomp
Loading required package: mvtnorm
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS
Attaching package: 'TH.data'
The following object is masked from 'package:MASS':
geyser
Loading required package: gridExtra
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HH/emptyMainLeftAxisLeftStripBottomLegend.Rd_%03d_medium.png", width=480, height=480)
> ### Name: emptyMainLeftAxisLeftStripBottomLegend
> ### Title: Remove main title, left axis tick labels, left strip, bottom
> ### legend from plot and keep the vertical spacing allocated to those
> ### items.
> ### Aliases: emptyMainLeftAxisLeftStripBottomLegend
> ### Keywords: hplot
>
> ### ** Examples
>
> ## This is a small example.
> ## See ?plot.likert for the complete example including motivation.
> ##
> require(grid)
> require(lattice)
> require(latticeExtra)
> require(HH)
>
> data(ProfChal)
>
> tmp <- data.matrix(ProfChal[,1:5])
> rownames(tmp) <- ProfChal$Question
> ProfChal.list <- split.data.frame(tmp, ProfChal$Subtable)
>
> Empl <- ProfChal.list[[2]]
>
> pct <- likert(Empl, as.percent="noRightAxis", xlab="Percent")
> pct
> count <- likert(Empl, rightAxis=TRUE,
+ xlab="Count", ylab.right="Row Count Totals",
+ scales=list(x=list(at=c(0, 100, 200))))
> count
> countEmptied <- HH:::emptyMainLeftAxisLeftStripBottomLegend(count)
> countEmptied
>
> tmp <- update(resizePanels(c(pct, countEmptied, y.same=TRUE, layout=c(2,1)), w=c(.8, .2)),
+ scales=list(y=list(alternating=3, limits=count$y.limits),
+ x=list(at=list(pct$x.scales$at, count$x.scales$at),
+ labels=list(pct$x.scales$labels,
+ count$x.scales$labels))),
+ xlab=c(" ", pct$xlab, " ", count$xlab),
+ between=list(x=1))
> tmp
>
>
>
>
>
> dev.off()
null device
1
>