Displaying 20 results from an estimated 7000 matches similar to: "How can strheight be calculated in lattice/grid?"
2004 Jan 27
1
ltext( pos=NULL )
ltext( 0, 0, pos=NULL, label="xxxx")
gives an error message.
The help page of ``ltext'' references to the help page of ``text''
where the default value of pos is set to NULL.
To solve the problem ``ltext'' could be changed:
OLD:
if (!missing(pos))
NEW:
if (!missing(pos) && ! is.null(pos) )
Wolfram
2003 Jan 24
1
problem with srt vector in xyplot {lattice}
[ R 1.6.1 ]
PROBLEM
The plot of the appended code does produce
a postscript file which is not interpretable
by gv under Linux.
REMARK
If the srt argument is commented out or set to a constant
like 45 or 90, the ps file becomes interpretable.
CODE
xytest <- function( ... ){
with( airquality, { print( xyplot(
Ozone ~ Temp | Month
, panel
2008 Feb 14
1
{lattice/grid} "Error using packet 1" and traceback
On some errors during the plot of a lattice/grid graphics, there is written
a message like "Error using packet 1: missing value where TRUE/FALSE needed"
into the concering panel and the next panel is plotted.
Which option I could use to stop the execution to have a look
at the error by a traceback?
Regards - Wolfram
2007 Nov 07
1
strwidth and strheight for rotated text
Dear All,
I would like to plot text with a box around it. I used strwidth and
strheight to compute the size of the box which is plotted with rect:
z <- rnorm(10)
# horizontal text works
plot(rnorm(10))
x1 <- 5
y1 <- 0
label <- "Label"
cha <- paste(" ", label, " ", sep = "")
xh <- strwidth(cha, cex = par("cex"))
yh <-
2003 Jan 15
1
lattice: cloud: aspect ratio, labels, vertical lines
I am interested to know how to make for clouds:
- aspect ratio = 1
- labels attached to points
- vertical lines from the points to the x/y base plane
I tried:
t = c( 'A', 'B', 'C', 'D' )
x = c( 100, 0, 200, 100 )
y = c( 0, 100, 0, 100 )
z = c( 80, 0, 20, 40 )
q = data.frame( x, y, z )
rownames( q ) = t
print(cloud( z ~ x *
2006 Dec 08
1
lattice: defining an own function using args for "formula" and "groups"
x.fun <- function( formula, data ) dotplot( formula, data )
x.grp <- function( formula, groups, data ) dotplot( formula, groups, data )
data( barley )
> x.fun( variety ~ yield | site, data=barley )
# no problem
> dotplot( variety ~ yield | site, groups=year, data=barley )
# no problem
> x.grp( variety ~ yield | site, groups=year, data=barley )
object "year" not found
2000 Apr 18
1
strheight() crashes without opened device (PR#524)
My mistake, but also a bug.
I did not open a device and called strheight("X").
==> R crashed
...\rgui --vanilla
[...]
> strwidth("X")
Error in strwidth("X") : plot.new has not been called yet
(OK.)
> strheight("X")
R crashed.
(Happens also on Solaris.)
Regards,
Uwe Ligges
--please do not edit the information below--
Version:
platform =
2004 Mar 04
1
lattice/grid: problem with viewports for strips with zero height
PROBLEM
# Allocating strip labels by the function strip.fun():
strip.test()
# Result: No strips: ok. No strings: NOT OK.
# The distance ``y.text=unit(6,"points")'' is ignored;
# the strings are not seen on the output.
TRIALS FOR WORKAROUNDS
strip.test( strip.lines=1 )
# Result: 2 strips: ok, but not whished. 2 strings: ok.
2003 Dec 22
1
[R] lattice: levelplot: error: min not meaningful for factor (PR#6005)
R 1.8.1:
___COMMAND____________________________________________
levelplot( yield ~ year * variety | site, barley )
___ERROR_MESSAGE______________________________________
Error in Summary.factor(..., na.rm = na.rm) :
"min" not meaningful for factors
___COMMENT____________________________________________
levelplot( yield ~ as.numeric(year) * as.numeric(variety) | site,
2002 May 03
2
sub() of matrix returns a vector and not a matrix
Is there a simple possibility
to become directly a matrix
from a call of sub() on a matrix?
--------- START OF LOGFILE ----------------
# R 1.4.1
> a <- matrix( letters[1:6], 2, 3 )
# a is a matrix
> print( a )
[,1] [,2] [,3]
[1,] "a" "c" "e"
[2,] "b" "d" "f"
> b <- sub( '(.)', '-\\1-', a )
2004 Oct 04
11
inverse function of order()
I have:
d <- sample(10:100, 9)
o <- order(d)
r <- d[o]
How I can get d (in the original order), knowing only r and o?
Thanks - Wolfram
2006 Nov 29
4
Why the factor levels returned by cut() are not ordered?
What is the reason, that the levels of the factor
returned by cut() are not marked as ordered levels?
> is.ordered( cut( breaks=3, sample(10 ) ) )
FALSE
> help(factor)
...
If 'ordered' is 'TRUE', the factor levels are assumed to be ordered.
...
Wolfram
2005 Apr 11
6
How to change letters after space into capital letters
What is the easiest way to change within vector of strings
each letter after a space into a capital letter?
E.g.:
c( "this is an element of the vector of strings", "second element" )
becomes:
c( "This Is An Element Of The Vector Of Strings", "Second Element" )
My reason to try to do this is to get more readable abbreviations.
(A suggestion would be to
2003 Jan 24
4
new function: showcolors {base}
I propose to add a function that allows
to display colors selected by a text pattern
or by color vectors in a plot.
Wolfram Fischer
#--- showcolors.R
showcolors <-
function(
col = "red"
, index = NULL
, pie = TRUE
, lwd = 6
, cex = 1.0
, main = NULL
, sub = NULL
, ...
){
n.colors <- length( col )
if( n.colors > 1 ){
main <- deparse( substitute( col ) )
2002 Apr 23
1
Writing text in lattice graphics
I'm trying to obtain a set of regression lines obtained for different values
of a factor using lattice. I would like to add a string to each panel showing
the R^2 value of the respective line, but I'm having difficulties positioning
the text (namely on which coordinates to give to the "ltext" function).
Here is what I'm using (I've used ?? for the things I would like
2007 Dec 09
1
Saving lattice plot as a PDF
Hi there,
I need to save a series of lattice plots as a PDF,
this is my code so far:
windows(height=8,width=6)
plot.new()
library('grid')
lattice.options(layout.heights=list(top.padding=list(x=0.15,
units="inches")))
print(plot1, split=c(1,1,2,3), more=TRUE)
print(plot2, split=c(1,2,2,3), more=TRUE)
print(plot3, split=c(1,3,2,3), more=TRUE)
print(plot4, split=c(2,1,2,3),
2010 Apr 01
2
How to get the scale limits in lattice plot
I am drawing a density histogram, and want to label the plots with the
mean using ltext(). But I need the x,y coordinates to feed into ltext,
and I can't calculate them easily from my data. Is there a way to get
the x and y ranges being used for the plot, so I can put the text at the
correct position in the panel.function?
Thanks,
Jim Rome
2010 Jan 24
1
lattice ltext
Dear friends - please give me a hand.
I have a dataset of 40 patients in two groups observed on three
occasions. I only want to plot a line
for each patient in the two groups. I use the ltext function to put the
patient number but fail to make lattice understand the numbers as
unique since apparently it starts all over with 1:20 for each panel
instead of respecting my desires to have 1:20
2005 Feb 15
1
lattice multiple plots per page
Dear R-sters,
I was wondering if anyone has encountered the following issues. I've
figured out how to get multiple levelplots [library(lattice)] on a single
plot. However, when I add text (adding axis labels for the entire four
panel plot) the text is missing when I insert the *.eps file I've created
into my LaTeX document (via MikTeX-WinEdt). And, I've just upgraded to R
2003 Aug 29
2
length() and nchar()
I would propose to add "
See also:
`nchar' for counting the number of character in
character vectors.
"
to the helpfile of length(),
because it is rather difficult
to find nchar() if one has only
search terms as "length", "len",
"strlen" in mind.
Sincerly
Wolfram Fischer