search for: stringwidth

Displaying 18 results from an estimated 18 matches for "stringwidth".

2010 Feb 22
2
(Somewhat) broken EPS files produced
...le attached). Individual eps files are interpreted by ghostscript just fine, and show up without errors. But once I try to include them into main LaTeX/Sweave document (using regular \includegraphics, produced by Sweave), ghostscript gives me this error on those files: Error: /undefinedresult in --stringwidth-- Operand stack: (600) 0.5 Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1...
2005 Jun 02
0
Thanks! (was panel.axis() & grid/lattice settings)
...should I be looking? > > > > > > Paul may be able to give a more insightful answer, but grid > allows a string to > > determine it's width in terms of itself, e.g.: > > > > unit(1, "strwidth", data = "foo") > > > Or just stringWidth("foo") (and of course stringHeight("foo")). > > > > If you want to convert that into, say, inches, you could use > > > > > >>convertX(unit(1, "strwidth", data = "foo"), "inches", TRUE) > > > > [1] 0...
2000 Apr 06
1
MetaPost device?
I would like to know if a MetaPost device is available or in the plans. A search MetaPost in the documents and list archives did not turn up anything. [I would prefer to use MetaPost when the graphics is to be included in a document that I want in both hard-copy and in pdf formats.] If not, how easy/hard is it to add a new device to R? I caouln't see anything about adding devices in the
2000 Apr 06
1
MetaPost device?
I would like to know if a MetaPost device is available or in the plans. A search MetaPost in the documents and list archives did not turn up anything. [I would prefer to use MetaPost when the graphics is to be included in a document that I want in both hard-copy and in pdf formats.] If not, how easy/hard is it to add a new device to R? I caouln't see anything about adding devices in the
2004 Nov 20
1
Error with strwidth after lattice graphic drawn
In platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major 2 minor 0.1 year 2004 month 11 day 15 language R I'm getting an error when using strwidth after a lattice graphic is drawn: library(lattice) xyplot(runif(20) ~ runif(20)) strwidth('xxx') Error in strwidth("xxx") : invalid graphics state Any help
2009 Oct 27
0
boxplot using grid
...I need to annotate the plot with something a little more elegant than arrows... I wrote the following function, which seems to work, but I'm not even sure how I'll get it to work with the above. # Bracket function Brack <- function(label, x = 0.5, y = 0.5){ require(grid) llab <- stringWidth(label) vpBrack <- viewport(x = x, y = y, height = unit(1, "npc"), width = llab + unit(4, "char")) pushViewport(vpBrack) grid.curve(unit(0, "char"), unit(0, "npc"), unit(4, "char"), unit(0.5, "npc"), inflect = T...
2001 Aug 08
2
box doesn't surround words in legend in printed output
I have made a plot with a legend and on the screen it looks fine, but when I save as jpg or pdf, or print, the legend box is too small, it cuts through the words on the right side. I put an example here: http://lark.cc.ukans.edu/~pauljohn/R/apdftest.pdf Is there a work around? -- Paul E. Johnson email: pauljohn at ukans.edu Dept. of Political Science
2000 Nov 16
1
postscript error
...dex 3 index moveto 1 index 4 -1 roll lineto exch 1 index lineto lineto closepath } def /p1 { stroke } def /p2 { bg setrgbcolor fill fg setrgbcolor } def /p3 { gsave bg setrgbcolor fill grestore stroke } def /t { 6 -2 roll moveto gsave rotate ps mul neg 0 2 1 roll rmoveto 1 index stringwidth pop mul neg 0 rmoveto show grestore } def /cl { initclip newpath 3 index 3 index moveto 1 index 4 -1 roll lineto exch 1 index lineto lineto closepath clip newpath } def /rgb { setrgbcolor } def /s { scalefont setfont } def /R { /Font1 findfont } def /B { /Font2 findfont...
2004 Jun 28
1
text length in grid
Hello! I first would like to compliment the authors of grid on what has been a wonderfully useful package for me. Now, my question: Is there any way I can specify the size of some grid.text using grid units? I must label the regions of a plot. The regions can be either very small or very large, so I would like to label each by fitting its text to the size of the region in question. Ideally, I
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,
2011 Oct 16
2
right justify right-axis tick values in lattice
How can I right justify the right-axis tick values? They appear in the example below as left-justified. I have tried several different ways and all fail in different ways. The example below creates the right axis tick value with no attempt at adjustment. alternates I have tried are 1. formatting the values. This doesn't work because they are in a proportional font and the blanks are too
2009 Sep 19
1
matrix operations on grobs and grid units
...ut, 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(). (Correct?). The input of this function is a vector of labels, which are arranged into a matrix layout. Below is my current version, followed by a few questions. e = expression(alpha,"testing very large width", hat(beta), integral(f(x)*dx, a, b)) rowMax.units <-...
2010 Aug 11
2
help to polish plot in ggplot2
Hi, I wanted to generate a plot which is almost like the plot generated by the following codes. category <- paste("Geographical Category", 1:10) grp1 <- rnorm(10, mean=10, sd=10) grp2 <- rnorm(10, mean=20, sd=10) grp3 <- rnorm(10, mean=15, sd=10) grp4 <- rnorm(10, mean=12, sd=10) mydat <- data.frame(category,grp1,grp2,grp3,grp4) dat.m <- melt(mydat) p <-
2004 May 26
6
Saving Trellis Graphics in R 1.9.0. (PR#6915)
Full_Name: Zdenek Valenta Version: 1.9.0. OS: Windows XP Submission from: (NULL) (147.231.7.250) I could not copy/save (Trelis) graphics using R version 1.9.0. The graphics displayed normally, but copying/saving it only produced an empty file. Everything works o.k. with R rel. 1.8.1. Best regards, Zdenek Valenta
2002 Mar 25
2
Extreme value distributions (Long.)
...veto 1 index 4 -1 roll lineto exch 1 index lineto lineto closepath } def /p1 { stroke } def /p2 { gsave bg setrgbcolor fill grestore newpath } def /p3 { gsave bg setrgbcolor fill grestore stroke } def /t { 6 -2 roll moveto gsave rotate ps mul neg 0 2 1 roll rmoveto 1 index stringwidth pop mul neg 0 rmoveto show grestore } def /cl { grestore gsave newpath 3 index 3 index moveto 1 index 4 -1 roll lineto exch 1 index lineto lineto closepath clip newpath } def /rgb { setrgbcolor } def /s { scalefont setfont } def /R { /Font1 findfont } def /B { /Font2 fi...
2004 Apr 12
1
R 1.9.0 is release
...g/accessing/modifying grob objects: grid.add(), grid.remove(), grid.edit(), grid.get() (and their *Grob() counterparts can be used to add, remove, edit, or extract a grob or the child of a gTree. NOTE: the new grid.edit() API is incompatible with the previous version. - Added stringWidth(), stringHeight(), grobWidth(), and grobHeight() convenience functions (they produce "strwidth", "strheight", "grobwidth", and "grobheight" unit objects, respectively). - Allowed viewports to turn off clipping altogether. Possible settings for view...
2004 Apr 12
1
R 1.9.0 is release
...g/accessing/modifying grob objects: grid.add(), grid.remove(), grid.edit(), grid.get() (and their *Grob() counterparts can be used to add, remove, edit, or extract a grob or the child of a gTree. NOTE: the new grid.edit() API is incompatible with the previous version. - Added stringWidth(), stringHeight(), grobWidth(), and grobHeight() convenience functions (they produce "strwidth", "strheight", "grobwidth", and "grobheight" unit objects, respectively). - Allowed viewports to turn off clipping altogether. Possible settings for view...
2004 Aug 27
1
selecting unique columns of a matrix/data frame
...= "") # NOTE "" not NULL > downViewport("panel.1") > pushViewport(viewport(clip="off")) # to be able to draw outside panel > grid.text(c("I", "R"), y=unit(-2, "lines"), > x=unit(0.5, "npc") - 0.5*stringWidth(c("I", "")), > just="left") > upViewport(0) > > ... (using stringWidth makes the hack scale with font size). > > In this case though, I think the ideal solution would be just to use a > font that has the desired character. On Window...