Displaying 20 results from an estimated 2000 matches similar to: "lattice: aligning independent graphs"
2005 Apr 14
2
Legend in xyplot two columns
Dear R-Help
I have some trouble to set the legend in a xyplot into two rows.
The code below gives me the legend in the layout I am looking for, I
just rather have it in two rows.
library(lattice)
schluessel <- list(
points=list( col="red", pch=19, cex=0.5 ),
text=list(lab="John"),
lines=list(col="blue"),
2010 Mar 19
2
lattice grob
Dear list,
I'm trying to arrange various grid objects on a page using a
frameGrob. It works fine with basic grobs (textGrob, gTree, etc.), and
also with ggplot2 objects using the ggplotGrob() function. I am
however stuck with lattice. As far as I understand, lattice produces a
list of class trellis, which is eventually displayed using the
plot.trellis method. I am not sure if/how one can
2005 Jun 23
1
Stop Warnings for Invalid Factor Level, NAs generated?
How can I stop the following warning from occuring?
invalid factor level, NAs generated in: "[<-.factor"(`*tmp*`, iseq, value =
structure(1, .Label = "12", class = "factor"))
The Label messages are for "5", "8", "12" and "46". I want the NAs to be
generated as needed.
Is this causing R to slow down by generating the warning
2013 Feb 25
2
lattice: column titles using xlab.top in multipanel xyplot
Hi,
I created a xyplot with a three-column layout. As suggested by Deepayan I tried to put titles to each column by using xlab.top. Unfortunately, as my y-axis scale relation = "free", the column titles are not centered at the three x axes anymore. Any idea how to center the titles?
#Example:
require(lattice)
#require(latticeExtra)
e <- data.frame(a = c(1:30), b = c(1:10, 20:29,
2009 Sep 19
1
matrix operations on grobs and grid units
Dear list,
As a minimal test of a more complex grid layout, I'm trying to find a
clean and efficient way to arrange text grobs in a rectangular layout.
The labels may be expressions, or text with a fontsize different of
the default, which means that the cell sizes should probably be
calculated using grobWidth() and grobHeight() as opposed to simpler
stringWidth() and stringHeight().
2008 Jan 12
2
Lattice equivalent of par(mfrow = )
Dear r-helpers,
Does anyone have a straightforward example of putting together three
unrelated (expect for a common y-axis) xyplot() figures in what would
be in base graphics a par(mfrow = c(1, 3)) arrangement?
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102
2009 May 08
1
centering axis labels in lattice
Hello,
I'm attempting to alter the location of text in my axis labels in
lattice plots and have been unsuccessful so far. For example, the
y-axis labels are always right-justified, but I would like them to be
horizontally centered.
Here's an example:
library(lattice);
# create fake dataset to plot
to.plot <- data.frame(
x = 1:5,
y = c("1\nAAA", "2\nBBB",
2012 Dec 12
2
long margin text below lattice plot - how to wrap lines?
Hello,
I've got a lattice plot and need to add text into the bottom margin of the plotting area (below the bottom legend).
This seems to work in principle using grid.arrange, yet the text to be added is rather long. As a consequence, it gets clipped:
require(lattice)
require(grid)
myplot <- xyplot(1~1)
mytext <- textGrob("This is such a very very long text that it goes on forever
2005 Oct 03
1
Grid: constructing a gTree with grobs that use named viewports from a vpTree
I'm trying to create a layout with named viewports that I can use for
other functions. I create the viewport tree that I want, and a list
of grobs with the viewports describing where they should go.
library(grid)
vp <- vpTree(
viewport(layout=grid.layout(2,2), name="layout"),
children=vpList(
viewport(layout.pos.col = 1, layout.pos.row=1, name="tl"),
2009 Sep 09
1
Xyplot, multi line title via main, all lines left justified
All,
Below is an xyplot plot with multiple panels and a title produced via main:
library("lattic")
data.ex = data.frame(y = rnorm(10), t = rep(1:5, 2), group = rep(c(0,1),
each = 5))
xyplot(y ~ t | as.factor(group), data = data.ex,
main = list("Put figure caption here xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
want this line left justified" ))
I must be mis-interpreting the
2010 Apr 28
1
Multiple cex sizes in main for xyplot?
Folks:
I would like to write two lines of text in two different font sizes (or
faces or ...) as the title ("main") of a trellis plot. The following code
does it, but not well:
xyplot((0:1)~(0:1),
main = textGrob(lab=c("Some Text","Some More Text"),y=c(.95,.8),
gp=gpar(cex=c(1.2,1.0)))
)
There is too much space between the title text and the plot. I assume
2008 Mar 19
1
betabinomial model
Hi,
can anyone help me fit betabinomial model to the following dataset where
each iD is a cluster in itself , if i use package aod 's betabinom model it
gives an estimate of zero to phi(the correlation coeficient ) and if i fix
it to the anova type estimate obtained from icc( in package aod) then it
says system is exactly singular. And when i try to fit my loglikelihood by
2007 Jun 18
1
Second y-axis in xyplot (lattice) where y1 and y2 have different ranges
Hi all,
I realize this is asking a lot of lattice, but I want to add a second y
axis inside a xyplot and have y1 and y2 have different ranges. Given dat
below, I can add a second y axis by overlaying a new plot with
par(new=T) and label axis 4 with standard graphics. I've seen an example
for doing something similar in xyplot even though Deepayan has indicated
that lattice isn't the right
2011 Apr 26
2
grid stringHeight
Dear all,
I'm puzzled by the behavior of stringHeight in the grid package.
Consider the following test,
library(grid)
test <- function(lab="dog", ...){
g1 <- textGrob(lab)
g2 <- rectGrob(height=grobHeight(g1), width=grobWidth(g1))
gg <- gTree(children=gList(g1,g2), ...)
print(c("height:", convertUnit(stringHeight(lab), "mm",
2005 Feb 18
1
Examples of multiple key grobs
The xyplot help page gives quite a lot of information how to use key
and indicates that legend needs to be used if multiple keys are
needed. However, it gives only a brief description of what the grob
needs to contain to do multiple keys.
I've only used the occasional grid function in panel functions, so I
don't have much of a sense of how grobs are constructed. I've been
unable to
2010 Mar 29
1
xyplot second y-xis and legend
Dear list,
I try to set a secondary y-axis in a lattice xyplot. This works. However, I
am unable to set a proper legend/key together with the 2nd y-axis under
general xyplot procedures. See example below.
The combination of the par.settings with simpleTheme and other settings
seems to go wrong.
I couldn't find a solution from previous topics. Any suggestions? thanks in
advance!
Robbert
2009 Sep 20
1
packGrob and dynamic resizing
Dear all,
I'm trying to follow an old document to use Grid frames,
Creating Tables of Text Using grid
Paul Murrell
July 9, 2003
As a minimal example, I wrote this,
gf <- grid.frame(layout = grid.layout(1, 1), draw = TRUE)
label1 <- textGrob("test", x = 0, just = "left", name="test")
gf=placeGrob(gf, rectGrob(), row = 1, col = 1)
gf=packGrob(gf,
2009 Oct 23
1
Distance between axis and label adjusted automatically?
Is there a way to have the distance between label and axis
adjusted automatically? This is interesting in particular for the
y-axis, when it is not known in beforehand how many digits the
numbers will have. It may happen then, that numbers and label
overlap.
All examples that I found work by estimating the required
distance manually in beforehand and then providing large enough
margins, or
2011 Apr 10
3
Adding margin text to lattice graphics
Colleagues
I am learning lattice graphics (R 2.12.2; OS X). Several days ago, I inquired about adding margin text to lattice graphics. Jim Price offered a useful reply, suggesting that I add:
page = function(page) grid.text('words', x = 0.5, y = 0.01)
to my call to the function. The entire function that he suggested was;
xyplot(1 ~ 1,
par.settings = list(layout.heights =
2013 Jan 15
5
Duda gráficos - paper="a4"
Buenos días:
A ver si alguien me puede iluminar, porque ya he sobrepasado los límites de mi paciencia y de mi imaginación con este asunto:
Dado un gráfico creado con un plot (y funciones auxiliares como polygon, etc.) y una tabla creada debajo de ese gráfico (creada con addtable2plot), y dados unos text situados a modo de título encima del plot y otros encima de la tabla, ¿por qué cuando trato