Displaying 20 results from an estimated 20000 matches similar to: "Error with strwidth after lattice graphic drawn"
2008 Jun 30
2
Plotting question: Problem with strwidth in 2.7.1
R users,
I have a problem with function strwidth in 2.7.1. I'm trying to set
the plot margins in a way that horizontal
column labels will fit to the graph. tmp.t is a list of data.frame
objects. This code works well in 2.6.0.
...snip..
library(gplots)
for (i in names(tmp.t)) {
bmp(filename=paste(i, "_", Sys.Date(), ".bmp", sep=""),
width=1038,
2005 Jun 02
0
Thanks! (was panel.axis() & grid/lattice settings)
Deepayan, Paul:
Thanks very much for the very useful leads. I just spent some time this
afternoon implementing your suggestions and my early test results are very
encouraging.
Paul, I understand the potential device re-sizing issue with the convert
family of functions in grid, and will be in touch in case it becomes
problematic for my applications. I very much look forward to your upcoming
2005 Jun 01
1
panel.axis() & grid/lattice settings
Hello,
I wish to customize the tick marks and labels of axes in panels produced by
high-level lattice functions, namely xyplot. I know I can use the scales
argument to specify values for rot, cex, etc. in the top-level call.
However, I am interested in determining values for cex and rot based on the
current panel / viewport and device. More specifically, I would like to make
adjustments when
2004 Dec 20
3
RE: [R] SAS or R software
Yes, par(family="mono") would work, except that I get R segfaults from this
sequence:
>
> plot.new()
> par(family="mono")
> par(cex=8)
> strheight("foo")
Process R segmentation fault (core dumped) at Mon Dec 20 16:07:56 2004
on R 2.0.1 (2004-11-15), Red Hat Enterprise Linux AS release 3
In my code I call strheight and strwidth several times in
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 <-
2002 Aug 14
1
strwidth
Dear plotting experts,
I need to determine the width of a string before plotting it to the
current device because I want to adjust `mai' to have
the necessary space available. It seems to me that this is an "hen and
egg" problem:
R> a <- "test"
R> strwidth(a)
Error in strwidth(a) : plot.new has not been called yet
# ok, I need an open device
R> plot(1:2,
2011 Jun 19
1
Accessor functions in lattice graphics
I know about the current.row, current.column, and panel.number functions that
are useful within panel functions written for lattice. Are there easy ways
to obtain the names of the conditioning variables (those appearing after |)
and their values for the current panel?
Thanks
Frank
-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context:
2007 Oct 30
3
strwidth of bold font
Hi!
Is there a way to get the string width of the bold typefaces?
like: strwidth("text", family = "serif", font = 2).
Thanks
Roland
2005 Jan 03
1
Black and white graphics and transparent strip panels with lattice under Sweave
What is the most elegant way to specify that strip panels are to have
transparent backgrounds and graphs are to be in black and white when
lattice is being used with Sweave? I would prefer a global option that
stays in effect for multiple plots.
If this is best done with a theme, does anyone have a lattice theme like
col.whitebg but that is for black and white?
I'm using the following
2012 Feb 29
1
Computing line= for mtext
I want to right-justify a vector of numbers in the right margin of a
low-level plot. For this I need to compute the line parameter to give to
mtext. Is this the correct scalable calculation?
par(mar=c(4,3,1,5)); plot(1:20)
s <- 'abcde'; w=strwidth(s, units='inches')/par('cin')[1]
mtext(s, side=4, las=1, at=5, adj=1, line=w-.5, cex=1)
mtext(s, side=4, las=1, at=7,
2005 Jun 11
1
Wishlist: strwidth allow for rotation of text (PR#7931)
Hi,
This is not a bug, but an enhancement suggestion. "strwidth" only gives the
width of the text according to the x-axis user coordinates, and similarly
for "strheight". Even if the par setting "srt" is changed to rotate the
text, the resulting width (resp. height) is in terms of the non-rotated
text. Currently, if I want to know how much space to leave for
2002 Sep 03
1
Properly initializing a plot
I have many functions for high-level plotting that early on in their code do something like strwidth('string', units='inches') before plotting. I do this before plot() to set the correct margins with par(mai=...), to leave room for wide text on the left or right margins.
If the plotting device is not opened strwidth( ) causes an error that plot.new() needs to be called. I can
2010 Apr 15
2
graphic question
Hello,
I have a simple question that I could not really figure out. I am plotting labels within a graph using the text function. I first plot the first label by specifying the x and y coordinates on the graph. Then to plot the second label next to it, I am using te strwidth function to get the width of the previous label in user coordinate then add the maximum width to the x value. However, this
2007 Dec 19
1
lattice: axes drawn when relation='free' or relation='sliced' but not when relation='same'
I'm using lattice to draw a multi-panel figure: 5 rows, 4 columns. The y-axis for each panel is determined by
yaxs <- list(draw=T
, labels=c(0, '.5', '1', '1.5')
, at=c(0, .5, 1, 1.5)
, tck=c(.4, 0)
, cex=.7
, alternating=2
2004 Dec 20
1
mono fonts (was RE: RE: [R] SAS or R software)
Ah, I'm using Exceed Hummingbird 7.1 as the X server....
It does have fixed width fonts, and it is happy with variable width fonts up
to this extreme ....
A little more fiddling shows that this succeds with a linux based X11
server, and that even
plot(1,1)
par(family="mono",cex=8)
text(1,1,"foo")
segfaults.
I've tested values of cex. Anything above 2.1249
2009 Jan 05
1
strwidth to lines
Dear members,
Is there a way to turn a strwidth of a string into a number of lines
that ist needed to display the string when using par(mar = c(?,4,4,2))
####
x = 1:5
names(x) = c("ZZZZZ","ZZZZZzzzzz","ZZZlllll","TTTTT","Zzhtsddfg" )
par(mfrow = c(1,2))
par(mar = c(8,4,4,2))
barplot(x, las = 3, main = "8 is to much")
par(mar =
2011 May 30
3
Syntax for lattice scales argument with |a*b
I have not been able to figure out the format for specifying limits, at,
labels in scales <- list(relation='free', limits=..., at=..., labels=...)
when there is more than one paneling variable, e.g., xyplot(y ~ x | a*b).
Thanks for any guidance.
Frank
-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context:
2013 Mar 02
1
Expressions in lattice conditional variables
I would like to have a lattice conditioning ( | var ) variable have
expression() as values because I want panel labels to be able to use
plotmath notation for subscripts, etc. lattice barks at this. Does anyone
know of a trick workaround? An attempted example program is below. Thanks
-Frank
require(lattice)
set.seed(1)
var <- c(rep('A', 100), rep('B', 100))
trt <-
2000 Nov 08
1
Graphics-Device-Size vs. Window-Size
I want to layout on screen a graphic bigger than the screen (width=16.53543,
height=11.69291) but strwidth() and strheight() give wrong results.
> x11(width=42/2.54, height=29.7/2.54, pointsize=12)
> plot(1,1, type="n", xlim=c(0, 1), ylim=c(-1, 0), xlab="", ylab="",
axes=FALSE)
> strwidth("Whatever")
[1] 0.08471151
> # Now resize the window and
2000 Nov 08
1
Graphics-Device-Size vs. Window-Size
I want to layout on screen a graphic bigger than the screen (width=16.53543,
height=11.69291) but strwidth() and strheight() give wrong results.
> x11(width=42/2.54, height=29.7/2.54, pointsize=12)
> plot(1,1, type="n", xlim=c(0, 1), ylim=c(-1, 0), xlab="", ylab="",
axes=FALSE)
> strwidth("Whatever")
[1] 0.08471151
> # Now resize the window and