Re: [R] Overlay Histogram

2012-08-08 Thread baptiste auguie
Hi, On 9 August 2012 08:40, li li hannah@gmail.com wrote: Dear all, I have a few extra questions regarding this. Below is my code. My questions are: (1), How can I remove the labels, tick marks and numbers, and the word density for the histgrams. (2) On the top right corner, there

Re: [R] Styling gridExtra's title and left labels

2012-08-07 Thread baptiste auguie
Hi, You can use a grob instead of a text string, e.g main = textGrob(Title goes here, gp=gpar(fontsize=24)) HTH, b. On 7 August 2012 03:49, Alastair alastair.and...@gmail.com wrote: Hi, I'm using the gridExtra package to combine some graphs like in the arrangeGrob example. Each of the

Re: [R] plot background - excel gradient style background ?

2012-06-29 Thread baptiste auguie
Looking at these, and in retrospect, if I were writing a manuscript of the pre-digital age, I would definitely add a burning mark as a finishing touch to complete the work. Perhaps waving the parchment above a burning candle. With modern digital support, you can fake a similar result using e.g.

Re: [R] Loop for multiple plots in figure

2012-06-27 Thread baptiste auguie
You can use main = unique(d$Subject) to solve this problem. HTH, b. On 27 June 2012 08:49, Marcel Curlin cemar...@u.washington.edu wrote: Well at this point I have what I need (rough plot for data exploration) but the simplicity of the first approach is quite elegant and it has become a

Re: [R] Loop for multiple plots in figure

2012-06-26 Thread baptiste auguie
Try this alternative solution using only base functions: # split the data into 4 data.frames l - split(data, data$Subject) names(l) # set up the graph parameters par(mfrow=n2mfrow(length(l)), mar=c(4,4,1,1), mgp = c(2, 1, 0)) # good old for loop over the subject names for( n in names(l)){ d -

Re: [R] Loop for multiple plots in figure

2012-06-25 Thread baptiste auguie
Hi, Here's one approach: plot_one - function(d){ with(d, plot(Xvar, Yvar, t=n)) # set limits with(d[d$param1 == 0,], lines(Xvar, Yvar, lty=1)) # first line with(d[d$param1 == 1,], lines(Xvar, Yvar, lty=2)) # second line } par(mfrow=c(2,2)) plyr::d_ply(data, Subject, plot_one) HTH, b.

Re: [R] Creating interactive 3D graphs for embedding in pdf not possible in R?

2012-06-22 Thread baptiste auguie
Hi, Try this post: http://r.789695.n4.nabble.com/Exporting-an-rgl-graph-tp1872712p1905113.html HTH, b. On 22 June 2012 19:26, Rainer M Krug r.m.k...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Just to be sure: I couldn't find a way of creating an interactive 3d

Re: [R] Format text with outline?

2012-06-19 Thread baptiste auguie
Have a look at this: http://stackoverflow.com/questions/7734535/control-font-thickness-without-changing-font-size and http://stackoverflow.com/questions/10686054/outlined-text-with-ggplot2 which refers to a base graphics version. HTH, b. On 20 June 2012 07:58, MacQueen, Don

Re: [R] Rotating characters in text

2012-06-12 Thread baptiste auguie
Try this, rotate = function(x) paste(strsplit(x,)[[1]],collapse=\n) t - this is a text plot.new() text(1/2,1/2,t) par(lheight=0.8) text(1/2,1/2,rotate(t)) HTH, b. On 13 June 2012 01:49, Stuart Rosen s.ro...@ucl.ac.uk wrote: For labelling a plot, I am trying to rotate a character string

Re: [R] Regions of significance plots with ggplot2

2012-06-05 Thread baptiste auguie
Hi, On 6 June 2012 08:58, Paul Murrell p.murr...@auckland.ac.nz wrote: Hi Here's one way to approach it ... ggplot(data.frame(x=1:10, y=1:10)) +  geom_polygon(aes(x=xx, y=yy), fill=grey70,               data=data.frame(xx=c(0, 0, 4, 4), yy=c(0, 11, 11, 0))) +  geom_point(aes(x=x, y=y))

Re: [R] package grid: mirror grob objects along an axis

2012-06-03 Thread baptiste auguie
Hi, Another option that you might want to try is the tikzDevice package; tikz has functions to flip and rotate objects and could it from R with tikzAnnotate / tikzAnnotateGrob. Of course these objects would not really be grobs but tikz code, though for text the end result would probably be the

Re: [R] sweave tables as images?

2012-05-25 Thread baptiste auguie
you can open a device that has the exact dimensions of the table, g = tableGrob(head(iris, 4)) png(test.png, width=convertWidth(grobWidth(g), in, value=TRUE), height=convertHeight(grobHeight(g), in, value=TRUE),units=in, res=150) grid.draw(g) dev.off() Doing this with knitr might be

Re: [R] sweave tables as images?

2012-05-25 Thread baptiste auguie
2012 09:43, Alexander Shenkin ashen...@ufl.edu wrote: this works - thanks baptiste!  i'm working in Sweave right now - perhaps it will be tough in knitr as you mention. On 5/25/2012 4:31 PM, baptiste auguie wrote: you can open a device that has the exact dimensions of the table, g = tableGrob

Re: [R] package grid: mirror grob objects along an axis

2012-05-22 Thread baptiste auguie
You can rotate the viewport to flip around the horizontal axis, library(grid) grid.text(Chiral) grid.text(Chiral, vp=viewport(angle=180, y=unit(0.5,npc)-unit(1,line))) HTH, b. On 23 May 2012 05:34, Thomas Zumbrunn t.zumbr...@unibas.ch wrote: Maybe my question was not concise enough. I was

Re: [R] package grid: mirror grob objects along an axis

2012-05-22 Thread baptiste auguie
Oops, sent too early; this obviously just a rotation, not a mirror image. It illustrates the problem though ;) b. On 23 May 2012 07:32, baptiste auguie baptiste.aug...@googlemail.com wrote: You can rotate the viewport to flip around the horizontal axis, library(grid) grid.text(Chiral

Re: [R] Catenating strings involving plotmath symbols.

2012-05-18 Thread baptiste auguie
Try this, bquote(.(L1) * .(L2)) HTH, b. On 19 May 2012 16:17, Rolf Turner rolf.tur...@xtra.co.nz wrote: In the context in which I am actually working it is necessary for me to build parts of a text string to place on a plot in two separate stages. The following toy example illustrates

Re: [R] New Eyes Needed to See Syntax Error

2012-05-17 Thread baptiste auguie
Your log10(HCO3 and sqrt(HCO3 seem to be missing closing brackets. HTH, baptiste On 18 May 2012 11:34, Rich Shepard rshep...@appl-ecosys.com wrote:  One of many scripts to produce 4 lattice plots on one page keeps throwing an error. I've tried manipulating the file to eliminate the error, but

Re: [R] Kerning of italic text in plotmath

2012-05-15 Thread baptiste auguie
For better typography, try tikzDevice, it uses LaTeX to render the text. b. On 16 May 2012 07:23, Fisher Dennis fis...@plessthan.com wrote: David You missed the point -- the issue was not the spacing between WORDS.  It was the spacing between LETTERS (as noted in the original email) Other

Re: [R] print table on plot

2012-04-26 Thread baptiste auguie
Hi, try also grid.table() in gridExtra b. On 27 April 2012 01:26, statquant2 statqu...@gmail.com wrote: Hello, I would like to be able to plot an array on a plot, something like:        |arg1  | arg2 | arg3 val1| 0.9    | 1.1    | 2.4 val2| 0.33  | 0.23 | -1.4 val3| hello| stop | test I

Re: [R] write a png inside a pdf for large graphics?

2012-04-23 Thread baptiste auguie
Hi, On 24 April 2012 05:00, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 23/04/2012 10:49 AM, Adam Wilson wrote: I routinely write graphics into multi-page PDFs, but some graphics (i.e. plots of large spatial datasets using levelplot()) can result in enormous files.  I'm curious if

Re: [R] How to flatten a multidimensional array into a dataframe?

2012-04-19 Thread baptiste auguie
library(plyr) adply(my.array,1:3) HTH, baptiste On 20 April 2012 08:46, Emmanuel Levy emmanuel.l...@gmail.com wrote: Hi, I have a three dimensional array, e.g., my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c(A1,A2), d2=c(B1,B2,B3), d3=c(C1,C2,C3,C4)) ) what I would like to get is

[R] scan() vs readChar() speed

2012-04-01 Thread baptiste auguie
Dear list, I am trying to find a fast solution to read moderately large (1 -- 10 million entries) text files containing only tab-delimited numeric values. My test file is the following, nr - 1000 nc - 5000 m - matrix(round(rnorm(nr*nc),3),nr=nr) write.table(m, file = a.txt, append=FALSE,

Re: [R] scan() vs readChar() speed

2012-04-01 Thread baptiste auguie
might be causing this? Thanks, baptiste On 2 April 2012 11:04, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 12-04-01 2:58 AM, baptiste auguie wrote: Dear list, I am trying to find a fast solution to read moderately large (1 -- 10 million entries) text files containing only tab-delimited

Re: [R] Adding text for written comments to bottom of graphs

2012-03-31 Thread baptiste auguie
Hi, On 1 April 2012 03:41, Paul Miller pjmiller...@yahoo.com wrote: Hello Baptiste, What you've done is very interesting. Went through and tried to understand all the steps. Reminded me of studying languages in years gone by. Always found it easier to read and understand a sentence than to

Re: [R] Adding text for written comments to bottom of graphs

2012-03-30 Thread baptiste auguie
Hi, I would do the following, library(ggplot2) require(reshape) TestData - structure(list(profile_key = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3), line = c(1, 1, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1), instance = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2), drug =

Re: [R] how to dev.off() all devices

2012-03-15 Thread baptiste auguie
Hi, Try this, replicate(sample(10,1), dev.new()) graphics.off() HTH, baptiste On 15 March 2012 20:36, Alaios ala...@yahoo.com wrote: Dear all, I would like at the beginning of my code to turn off all the remaining open devices. How can I do that by using dev.off()? I would like to

Re: [R] Two dimensional integration

2012-03-12 Thread baptiste auguie
Hi, Try the cubature package, and maybe play with the tolerance. HTH, b. On 13 March 2012 18:39, Niroshan wnnpe...@ucalgary.ca wrote: Dear R Members, I want to know a fast R function to do multidimensional integration.  I used the function 'cuhre' in R2cuba library. But it takes painful

Re: [R] Computing line= for mtext

2012-03-02 Thread baptiste auguie
Hi, If you're going to use different text sizes and convert between units, it might be easier to do the calculations with grid. par(mar=c(1,1,1,5)) plot(1:10) labels = c(1, 2, 10, 123, 3.141592653589, 1.2, 2) sizes = c(1, 1, 2, 1, 0.4, 1, 3) # cex of individual labels ## pure base graphics

Re: [R] parse .ps files with R?

2012-02-18 Thread baptiste auguie
Hi, the grImport package provides some tools for this. HTH, b. On 19 February 2012 16:06, Nick Matzke mat...@berkeley.edu wrote: Hi, Is there a way to parse a postscript (*.ps) file with R (or perhaps with some other command-line utility)? E.g., I have a map in postscript format with

Re: [R] Defining a viewport scale in {Grid}

2012-02-16 Thread baptiste auguie
The default units of polygonGrob are npc, I think you want native instead. Try the following, library(grid) d = data.frame(x=rnorm(100, 10), y=rnorm(100, -100)) v = dataViewport(xData=d$x, yData=d$y) grid.points(d$x,d$y, default.units=native, vp=v) HTH, b. On 17 February 2012 02:47,

Re: [R] Color cells of a matrix as in Excel

2012-02-14 Thread baptiste auguie
A minimum code to plot a coloured matrix with text labels could be the following: library(grid) library(scales) library(RColorBrewer) diverging_palette - function(d = NULL, centered = FALSE, midpoint = 0, colors = brewer.pal(7,PRGn)){ half - length(colors)/2

Re: [R] Version control (git, mercurial) for R packages

2012-02-09 Thread baptiste auguie
Once upon a time r-forge had the option to sync from an external svn repository, e.g. hosted on googlecode. I haven't seen it available for some time, sadly. I'm sure many users would appreciate if this feature came back with the new interface. Not sure if it could work with git as well, though.

Re: [R] 3D confidence ellipsoid with ellipse projections onto 2D plane

2012-02-08 Thread baptiste auguie
Hi, If you read French, you might find the following discussion interesting, http://www.forum.math.ulg.ac.be/viewthread.html?id=45765 It contains some good suggestions to project an ellipsoid onto a plane, which as I understand might be related to your question. HTH, b. On 8 February 2012

Re: [R] Version control (git, mercurial) for R packages

2012-02-08 Thread baptiste auguie
On 9 February 2012 13:02, David Winsemius dwinsem...@comcast.net wrote: On Feb 8, 2012, at 6:33 PM, Tom Roche wrote: Peter Langfelder Thu Feb 9 00:01:31 CET 2012 I'm exploring using a version control system +1! welcome to the new millenium :-) to keep better track of changes to the [R]

Re: [R] how do I exort a list of numbers into csv file?

2012-02-05 Thread baptiste auguie
Hi, If you don't mind having NAs for missing values, try the following, mylist = list(1:3, 4:7) library(plyr) write.csv(do.call(rbind.fill.matrix, lapply(mylist, matrix, nrow=1)), file=) HTH, b. On 6 February 2012 15:01, Michael comtech@gmail.com wrote: Hi all, I have a list of vector

Re: [R] How I assign the result of a plot to a variable?

2012-01-29 Thread baptiste auguie
Try this, plot(1:10) img - grid::grid.cap() # grid.raster(img) stream - col2rgb(img) write.table(stream, file=dam.txt, row.names = FALSE, col.names = FALSE) (you'll have to restore the dimensions of the matrix once you've read the rgb values for each pixel) HTH, baptiste On 30

Re: [R] logical subsetting, indexes and NAs

2012-01-28 Thread baptiste auguie
Hi, which(x 15) omits the NA (treated as false). HTH, b. On 29 January 2012 09:36, Federico Calboli f.calb...@imperial.ac.uk wrote: Dear All, just a quick example: x  = 1:25 x[12] = NA x  [1] 1 2 3 4 5 6 7 8 9 10 11 NA 13 14 15 16 17 18 19 20 21 22 23 24 25 y = x[x10] y  [1]  1

Re: [R] Gray levels

2012-01-25 Thread baptiste auguie
The scales package? gradient_n_pal(c(red,white,blue), c(0,0.5,1)) (seq(0,1,length=100)) HTH, baptiste On 26 January 2012 10:36, Jeffrey Joh johjeff...@hotmail.com wrote: The gray (level) function returns different shades of gray, where level is a vector of numbers ranging from 0 to 1.  0

Re: [R] graph paper look

2012-01-18 Thread baptiste auguie
You could draw a grid with grid, using grid.grill, library(grid) pdf(grid.pdf, width=21/2.54,height=29.7/2.54) grid.grill(h = unit(seq(0, 297, by=1), mm), v = unit(seq(0, 210, by=1), mm), gp=gpar(col=grey,lwd=0.1)) grid.grill(h = unit(seq(0, 297, by=5), mm), v = unit(seq(0,

Re: [R] Executable expressions

2012-01-18 Thread baptiste auguie
One reason might be that you can easily fool the user into running unexpected/unreadable commands. Guess what this does: cmd - paste(c(letters[c(19L, 25L, 19L, 20L, 5L, 13L)], (' , letters[c(19L, 21L, 4L, 15L)], , letters[c(4L, 5L, 19L, 20L, 18L, 15L, 25L)], , letters[c(1L, 12L, 12L)], ')),

Re: [R] ggExtra package installation fails

2012-01-15 Thread baptiste auguie
ggExtra was not compatible with the recent changes in ggplot2 and had become partially redundant, so I removed it. grid.arrange and arrangeGrob in gridExtra won't help with the alignment of axes. align.plots, which I can always send you offlist if you want, extracted the size of axes and legends

Re: [R] black and white in qplot? layout 4 graphs in one screen

2011-12-23 Thread baptiste auguie
Hi, On 22 December 2011 09:16, rachaelohde cox.rach...@gmail.com wrote: Hello, I am trying to plot means and standard errors conditioned by a factor, using qplot.  I am successful at getting the bar graph I want with a error bar, however I have tried many things and cannot get the bars to

Re: [R] rendering or raytracing?

2011-12-19 Thread baptiste auguie
Hi, package planar is concerned with the full electromagnetic problem at planar interfaces, which is not very useful for raytracing. The cda package includes a small demo interfacing either rgl or povray (via system call) to visualize 3D clusters of metallic particles. A more general interface to

Re: [R] How to fill irregular polygons with patterns?

2011-11-18 Thread baptiste auguie
Hi, Two possible routes I can suggest: 1- export the plot in svg format, which supports natively the use of filling patterns, e.g. http://www.w3.org/TR/SVG/images/pservers/pattern01.svg It's possible that the gridSVG package could help you automate the process of grid.garnish()-ing the grobs;

Re: [R] grid.arrange, grid.layout - legend, global y axis title

2011-11-15 Thread baptiste auguie
Hi, Please don't cross post. It seems that ggplotGrob has been replaced by new functions. You can define it as ggplotGrob - function(x) ggplot2:::gtable_gTree(ggplot2:::ggplot_gtable(x)) and it seems to work as before with grid.arrange(). HTH, baptiste On Wed, Nov 16, 2011 at 3:26 AM,

Re: [R] regular expression for selection

2011-11-14 Thread baptiste auguie
Hi, Try grepl instead of sub, mena[grepl(m5., mena)] HTH, baptiste On 14 November 2011 21:45, Petr PIKAL petr.pi...@precheza.cz wrote: Dear all I am again (as usual) lost in regular expression use for selection. Here are my data: dput(mena)

Re: [R] performance of adaptIntegrate vs. integrate

2011-11-11 Thread baptiste auguie
Dear Ravi, Thank you for your answer. The integrand I proposed was a dummy example for demonstration purposes. I experienced a similar slowdown in a real problem, where knowing in advance the shape of the integrand would not be so easy. Your advice is sound; I would have to study the underlying

Re: [R] performance of adaptIntegrate vs. integrate

2011-11-11 Thread baptiste auguie
Dear Hans, [see inline below] On 11 November 2011 22:44, Hans W Borchers hwborch...@googlemail.com wrote: baptiste auguie baptiste.auguie at googlemail.com writes: Dear list, [cross-posting from Stack Overflow where this question has remained unanswered for two weeks] I'd like

[R] performance of adaptIntegrate vs. integrate

2011-11-10 Thread baptiste auguie
Dear list, [cross-posting from Stack Overflow where this question has remained unanswered for two weeks] I'd like to perform a numerical integration in one dimension, I = int_a^b f(x) dx where the integrand f: x in IR - f(x) in IR^p is vector-valued. integrate() only allows scalar integrands,

Re: [R] adjusting levelplot color scale to data

2011-11-06 Thread baptiste auguie
Hi, Try specifying explicit break points together with their corresponding colors using at and col.regions, levelplot(m, at= unique(c(seq(-2, 0, length=100), seq(0, 10, length=100))), col.regions = colorRampPalette(c(blue, white, red))(1e3)) HTH, baptiste On 7 November 2011 16:08, Lanna Jin

Re: [R] palettes for the color-blind

2011-11-02 Thread baptiste auguie
Hi, Try the dichromat package (also dichromat_pal in the scales package). HTH, baptiste On 3 November 2011 10:26, Max Kuhn mxk...@gmail.com wrote: Everyone, I'm working with scatter plots with different colored symbols (via lattice). I'm currently using these colors for points and lines:

Re: [R] Plotting text?

2011-10-21 Thread baptiste auguie
Try this, library(grid) grid.newpage() grid.text(text) HTH, baptiste On 22 October 2011 13:26, rkevinbur...@charter.net wrote: I noticed that the text() command adds text to a plot. Is there a way to either make the plot blank or add text to a blank sheet. I would like to plot a page that

Re: [R] converting string fractions to numerics

2011-10-19 Thread baptiste auguie
Hi, I believe you want eval(parse(text=pi/2)) a word of warning exemplified in eval(parse(text=library(fortunes) ; fortune(106))) HTH, baptiste On 19 October 2011 19:30, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: Suppose I have the following: pi/2 and I would like

Re: [R] Simple color strip

2011-10-19 Thread baptiste auguie
Hi, Perhaps the easiest way is with grid.raster, library(grid) pdf(colorstrip.pdf, height=1, width=10) grid.raster( t(myCols), width=unit(1,npc), height=unit(1,npc), interpolate=FALSE) dev.off() HTH, baptiste On 20 October 2011 03:32, Brian Smith bsmith030...@gmail.com wrote: Hi, I was

Re: [R] right justify right-axis tick values in lattice

2011-10-16 Thread baptiste auguie
Hi, You could also pad the text labels with phantom 0s, ghostrighter - function(x, ...){ n - sapply(x, nchar) nmax - max(n) padaone - function(ii){ si - paste(rep(0, length= nmax - n[ii]), collapse=) as.expression(bquote(phantom(.(si)) * .(x[ii]) )) } sapply(seq_along(x),

Re: [R] using do.call to call a list of functions

2011-10-14 Thread baptiste auguie
package plyr makes it easier, plyr::each(function.list)(pi) HTH, baptiste On 15 October 2011 11:55, Richard M. Heiberger r...@temple.edu wrote: function.list=c(sin, cos, function(x) tan(x)) for (f in function.list) print(f(pi)) [1] 1.224606e-16 [1] -1 [1] -1.224606e-16 On Fri, Oct 14,

Re: [R] white on black theme for ggplot2

2011-10-05 Thread baptiste auguie
Hi, there are a couple of themes proposed in the wiki, one being white on black, https://github.com/hadley/ggplot2/wiki/Themes HTH, baptiste On 6 October 2011 04:05, Eugene Kanshin kanshin...@gmail.com wrote: Hello, I'm trying to produce some plots in ggplot2 to use them on the dark-blue

Re: [R] Display a contingency table on the X11 device

2011-10-05 Thread baptiste auguie
On 6 October 2011 09:23, Dennis Murphy djmu...@gmail.com wrote: Hi: One option is the gridExtra package - run the example associated with the tableGrob() function. Another is the addtable2plot() function in the plotrix package. I'm pretty sure there's at least one other package that can do

Re: [R] adding a dummy variable...

2011-10-04 Thread baptiste auguie
Hi, Using ddply, ddply(df, .(ID), mutate, nrows=length(rel.head), test = nrows==2 all(rel.head %in% c(1,3))) HTH, baptiste On 5 October 2011 06:02, Dennis Murphy djmu...@gmail.com wrote: Hi: Here's another way to do it with the plyr package, also not terribly elegant. It assumes that

Re: [R] new standardised variable based on group membership

2011-10-03 Thread baptiste auguie
More concisely, ddply(Orange, .(Tree), transform, scaled = scale(age)) HTH, baptiste On 4 October 2011 11:24, john.morrongie...@csiro.au wrote: That works a treat Thierry, thanks! I wasn't aware of the plyr package but I like what it does- I'll put it to use work in the future. Regards

Re: [R] How to turn a LaTeX Sweave file (Rnw) into .HTML/.odf/.docx? (under windows)

2011-09-22 Thread baptiste auguie
Have you tried asciidoc (ascii package)? It seems like a good fit for your needs. baptiste On 23 September 2011 11:09, Tal Galili tal.gal...@gmail.com wrote: Hello dear R help members, I have found several references on how to do this, my question is if anyone is actually using them - and

Re: [R] Add png image outside plot borders

2011-09-18 Thread baptiste auguie
Hi, if your logo is in vector format you should probably try the grImport package; see its vignette for examples, also below, library(grImport) ## http://creativecommons.org/about/downloads/ PostScriptTrace(cc.logo.eps) cc - readPicture(cc.logo.eps.xml) logo - pictureGrob(cc[16:18], x=unit(1,

Re: [R] Coloring Dirichlet Tiles

2011-09-04 Thread baptiste auguie
Hi, Try this, d - data.frame(x=runif(1e3, 0, 30), y=runif(1e3, 0, 30)) d$z = (d$x - 15)^2 + (d$y - 15)^2 library(spatstat) library(maptools) W - ripras(df, shape=rectangle) W - owin(c(0, 30), c(0, 30)) X - as.ppp(d, W=W) Y - dirichlet(X) Z - as(Y, SpatialPolygons) plot(Z,

Re: [R] ggplot2 to create a square plot

2011-09-01 Thread baptiste auguie
Hi, Are you after this? last_plot() + opts(aspect.ratio=1) Also, see https://github.com/hadley/ggplot2/wiki/Themes for some settings re: plot margins. HTH, baptiste On 1 September 2011 05:18, Alaios ala...@yahoo.com wrote: Dear all, I am using ggplot with geom_tile to print as an image a

Re: [R] Scatter Plot Command Syntax Using Data.Frame Source

2011-08-31 Thread baptiste auguie
Hi, Below are a couple of options using a standard dataset, str(iris) ## using base graphics d - split(iris, iris$Species) str(d) # list of 3 data.frames par(mfrow=n2mfrow(length(d))) # split the device in 3 plotting regions b.quiet - lapply(names(d), function(x) { # loop over the list names

Re: [R] Writing non-graphic (text) output to PDF

2011-08-19 Thread baptiste auguie
Hi, Try this, library(gridExtra) example(grid.table) or addtable2plot() in plotrix, or textplot() in gplots, or Hmisc using latex, or Sweave, ... HTH, baptiste PS: please read the posting guide On 20 August 2011 05:14, Ed Heaton heat...@comcast.net wrote: Hi, friends. I keep coming to

Re: [R] Can you send side effect text into a variable?

2011-08-15 Thread baptiste auguie
Hi, Try this, ?capture.output as in, capture.output(cat(this is it)) HTH, baptiste PS: Here's another example for fun, # begin absurd example library(textplot) capture.output(txtplot(1:10)) library(gplots) textplot(capture.output(txtplot(1:10))) library(grid) grid.cap() # not sure how to

Re: [R] Query for semi-transparency support

2011-08-15 Thread baptiste auguie
Here's a warning, but it sounds like it's at a deep (C, presumably) level, xfig() grid::grid.rect(gp=gpar(fill=red, alpha=0.5)) Warning message: In grid.Call.graphics(L_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just, : semi-transparency is not supported on this device: reported only

Re: [R] 3D Bar Graphs in ggplot2?

2011-08-03 Thread baptiste auguie
A barplot rendered with povray, http://zoonek2.free.fr/UNIX/48_R/03.html#10 At the other end of the spectrum, library(txtplot) x - factor(c(orange, orange, red, green, green, red, yellow, purple, purple, orange)) o - capture.output(txtbarchart(x)) library(gplots) textplot(o)

[R] grImport symbols

2011-07-30 Thread baptiste auguie
Dear list, I have two questions regarding grid.symbols() in the grImport package. This package allows you to import a vector graphic in R, and grid.symbols() can be used to plot the resulting glyph at arbitrary locations in a grid viewport. I have tried the code in the grImport vignette, which

Re: [R] plot a vertical column of colored rectangles

2011-07-16 Thread baptiste auguie
Hi, You could try grid.colorstrip() from the gridExtra package, grid.colorstrip(ifelse(dat, blue, red)) or grid.raster(), which should be more efficient, grid.raster(matrix(ifelse(dat, blue, red)), interp=FALSE, width=unit(1,npc), height=unit(1,npc)) HTH, baptiste On 15 July 2011 22:20,

Re: [R] Creating a Polar Plot with expanding points as radius increases

2011-06-27 Thread baptiste auguie
Try this, library(ggplot2) d - data.frame(theta = runif(10, 0, 360), r = runif(10, 0, 3)) ggplot(d, aes(x=theta, y=r, size=r)) + coord_polar(start=0)+ geom_point() + scale_x_continuous(breaks=seq(0, 360, by=30), expand=c(0,0), lim=c(0, 360))+ scale_area() HTH, baptiste On 28 June 2011

Re: [R] Placing Text on ggplot2 graphics vs. xyplot

2011-06-16 Thread baptiste auguie
Hi, As far as I know secondary y-axis and multiple pages are not possible in ggplot2 (there are workarounds for the latter in the ggplot2 list archives). For the subtitle, you could implement it with grid.text and grid viewports, library(gridExtra) library(ggplot2) grid.arrange( qplot(1,1), sub

Re: [R] gridExtra with cairodevie and ggplots

2011-06-14 Thread baptiste auguie
Hi, You can draw arrangeGrob in a rotated viewport, library(gridExtra) library(ggplot2) ps = replicate(4, qplot(rnorm(10), rnorm(10)), simplify=F) g = gTree(children=gList(do.call(arrangeGrob, ps)), vp=viewport(angle=90)) grid.draw(g) though you get some warnings about clipping for some reason.

Re: [R] Heatmap in R and/or ggplot2

2011-06-13 Thread baptiste auguie
Hi, Try this ggplot(df, aes(x,y)) + geom_tile(aes(fill=height), colour=white) + scale_fill_gradientn(colours = c(red, gold, green)) + geom_text(aes(lab=height)) HTH, baptiste On 14 June 2011 07:12, idris idris.r...@gmail.com wrote: I have a dataframe df with columns x, y, and height. I want

Re: [R] cbind 3 or more matrices

2011-06-04 Thread baptiste auguie
A, B, C should have the same number of rows. mlist = replicate(3, matrix(rnorm(6), 2), simplify=FALSE) names(mlist) = LETTERS[seq_along(mlist)] with(mlist, cbind(A,B,C)) or, do.call(cbind, mlist) HTH, baptiste On 5 June 2011 11:14, Jim Silverton jim.silver...@gmail.com wrote: How can I

Re: [R] Value of 'pi'

2011-05-31 Thread baptiste auguie
I propose a Pi Haiku (PIQ), Pi is of certain value, In statistics, invaluable, yet Transcending numerics. Best, baptiste On 1 June 2011 11:55, Ravi Varadhan rvarad...@jhmi.edu wrote: Nice to know that the `pi' can be sliced in so many different ways! There are exactly 3.154 x e08 seconds in

Re: [R] Group by multiple variables

2011-05-30 Thread baptiste auguie
Hi, There are probably much better ways, but try this transform(dat, group = as.numeric(factor(paste(A,B,C, sep= HTH, baptiste On 31 May 2011 09:47, Mendolia, Franco fmendo...@mcw.edu wrote: Hello, I would like to create a group variable that is based on the values of three

Re: [R] identical function names from 2 packages

2011-05-20 Thread baptiste auguie
I imagine mind_read() easy to implement with Robin Hankin's emulator package -- under some weak assumptions about the user; mind_write(), however, seems more involved and might require investing in new hardware. Best, baptiste On 21 May 2011 12:04, Rolf Turner rolf.tur...@xtra.co.nz wrote: On

Re: [R] %in% operator - NOT IN

2011-05-08 Thread baptiste auguie
Hi, On 8 May 2011 21:18, Berwin A Turlach berwin.turl...@gmail.com wrote: G'day Dan, On Sun, 8 May 2011 05:06:27 -0400 Dan Abner dan.abne...@gmail.com wrote: Hello everyone, I am attempting to use the %in% operator with the ! to produce a NOT IN type of operation. Why does this not work?

Re: [R] Options for print()

2011-05-05 Thread baptiste auguie
Hi, Try this, cat(format(The TITLE, width=80, justify=centre)) HTH, baptiste On 5 May 2011 19:28, Dan Abner dan.abne...@gmail.com wrote: Hello everyone, I have a few questions about the print() fn: 1) I have the following code that does not center the character string: print(The

Re: [R] adaptIntegrate - how to pass additional parameters to the integrand

2011-05-03 Thread baptiste auguie
Hi, The package maintainer is aware of this feature request. In the meantime, I've used Currying, require(cubature) f - function(x, a) cos(2*pi*x*a) # a simple test function adaptIntegrate(roxygen::Curry(f, a=0.2), lower=0, upper=2) HTH, baptiste On 4 May 2011 05:57, Ravi Varadhan

Re: [R] multiple mosaic plots layout

2011-05-01 Thread baptiste auguie
Unfortunately, it seems that vcd doesn't return grobs but draws directly to the device, which prevents a concise solution. You could try the following, library(gridExtra) library(vcd) data(Titanic) p = grid.grabExpr(mosaic(Titanic)) grid.arrange(p, p, p, ncol=2) Or, more versatile but also more

Re: [R] splom, plotmath: how to add three lines of information with alignment?

2011-04-20 Thread baptiste auguie
)), ncol=2, byrow=T) grid.table(d, parse=T,theme=theme.list( gpar.corefill=gpar(fill=NA, col=NA), core.just=left, padding.h = unit(0, mm) )) HTH, baptiste On 2011-04-20, at 01:33 , baptiste auguie wrote: Hi, You may want to wait advice from someone who

Re: [R] grid.table + splom: how to nicely align panel entries

2011-04-20 Thread baptiste auguie
On 20 April 2011 21:16, Marius Hofert m_hof...@web.de wrote: Dear expeRts, is there a way to get the entries in each panel correctly aligned according to the equality signs? Here is the wish-list: (1) the equality signs in each panel should be vertically aligned You can put the equal

Re: [R] grid.table + splom: how to nicely align panel entries

2011-04-20 Thread baptiste auguie
)))        arr[i,j,] - c(alpha, eq, numbers[1],                       italic(bbb), eq, numbers[2],                       gamma, eq, numbers[3])    } } ## plot splom2(x, arr, nr=3) On 2011-04-20, at 11:56 , baptiste auguie wrote: On 20 April 2011 21:16, Marius Hofert m_hof...@web.de wrote

Re: [R] grid.table + splom: how to nicely align panel entries

2011-04-20 Thread baptiste auguie
])    } } ## plot splom2(x, arr, nr=3) On 2011-04-20, at 22:38 , baptiste auguie wrote: Try this, align.digits = function(l) { sp - strsplit(as.character(l), \\.) chars - sapply(sp, function(x) nchar(x)[1]) n = max(chars) - chars l0 = sapply(n, function(x) paste(rep(0, x), collapse=)) labels

Re: [R] splom, plotmath: how to add three lines of information with alignment?

2011-04-19 Thread baptiste auguie
=gpar(fill=NA, col=NA), # make bg transparent               core.just=left) # justification of labels               ) } xyplot(1~1, panel=function(...) info(0.1, 0.5) ) On 2011-04-19, at 21:39 , David Winsemius wrote: On Apr 19, 2011, at 3:26 PM, baptiste auguie wrote: I'm hoping

Re: [R] splom, plotmath: how to add three lines of information with alignment?

2011-04-19 Thread baptiste auguie
Hi, You may want to wait advice from someone who actually understands (the labyrinth that is) lattice's help for splom, but the following might be a start. I didn't understand what values you actually wanted displayed in the lower triangle panels, so I made up some random ones in a 3x3 matrix of

Re: [R] splom, plotmath: how to add three lines of information with alignment?

2011-04-18 Thread baptiste auguie
Hi, Does this help? library(gridExtra) my.title = function(expressions) { grid.table(expressions, parse=TRUE, theme=theme.list(gpar.corefill = gpar(fill = NA, col = NA), core.just = left)) } e = expression(alpha,text, italic(italic), hat(beta),

Re: [R] splom, plotmath: how to add three lines of information with alignment?

2011-04-18 Thread baptiste auguie
you'll need a more recent version of gridExtra than the one on CRAN. You can get it here: http://code.google.com/p/gridextra/ baptiste Cheers, Marius On 2011-04-19, at 24:03 , baptiste auguie wrote: Hi, Does this help? library(gridExtra) my.title = function(expressions) {  grid.table

Re: [R] Deleting the last value of a vector

2011-04-17 Thread baptiste auguie
Hi, Try this, snip = function(x, n=1) { rand = sample(1:3, 1) print(paste(using algorithm #, rand)) switch(rand, '1' = head(x, length(x) - n), '2' = x[ seq(1, length(x) - n) ], '3' = x[ - seq(length(x), by=-1, length=n) ]) } snip(1:5) HTH, but please

Re: [R] Plotting an Underbrace in R

2011-04-15 Thread baptiste auguie
Hi, Through pgfSweave you can use the tikz device, which is the one that can interpret Latex code (package tikzDevice). I would start with a minimal self-contained plot with this function. see ?tikz for examples. HTH, baptiste On 15 April 2011 20:03, Michael McAssey mpmcas...@gmail.com

[R] modify particular factor levels

2011-04-14 Thread baptiste auguie
Dear list, I wish to modify programmatically only a few factor levels, according to a named list. I came up with this function, modify.levels - function(f, modify=list()){ ## levels that will not be changed names.old.levels - setdiff(levels(f), unlist(modify)) ## as a named list

Re: [R] R plots pdf() does not allow spotcolors?

2011-04-13 Thread baptiste auguie
Hi, I may be wrong, but I have the impression that tikz (a LaTeX drawing package) can handle spot colors (that's what Google seemed to tell me [*]). If this is the case you could output R graphics using the tikzDevice package, post-process the output (readable, plain text file), and eventually

Re: [R] FW: [r] how to enclose two xyplot

2011-04-13 Thread baptiste auguie
Hi, Have you tried ?c.trellis in the latticeExtra package? HTH, baptiste On 13 April 2011 23:36, Francesco Nutini nutini.france...@gmail.com wrote:  Dear R-users, I have to plot two xyplot, and I wish to enclose this two graphs with just one headline, the same x scale, the same grid etc.

Re: [R] Line plots in base graphics

2011-04-13 Thread baptiste auguie
On 14 April 2011 07:51, Hadley Wickham had...@rice.edu wrote: Am I missing something obvious on how to draw multi-line plots in base graphics? In ggplot2, I can do: It appears you've been infected with what I like to call the Dijkstra syndrome [*], quoting The tools we use have a profound

Re: [R] Assign with Paste Problem

2011-04-12 Thread baptiste auguie
Hi, You probably need ?get, though you might want to read this first, library(fortunes) fortune(236) HtH, baptiste On 13 April 2011 13:04, Sparks, John James jspa...@uic.edu wrote: Dear R Helpers, I am trying to change the name of an object using the assign function. When I use paste on

Re: [R] multiple lines on multiple plots

2011-04-12 Thread baptiste auguie
Hi, ggplot2 automatically adjusts its axes when new data are added to plots; however you wouldn't get an automatic legend if you constructed plots that way. HTH, baptiste On 13 April 2011 17:06, James Annan jdan...@jamstec.go.jp wrote: Thanks for all the replies. Yes, I agree that calculating

Re: [R] bind mean to a df

2011-04-11 Thread baptiste auguie
Hi, You could try, library(plyr) ddply(data, .(name), transform, mean=mean(sale)) ddply(data, .(name), summarize, mean=mean(sale)) HTH, baptiste On 12 April 2011 15:46, Geoffrey Smith g...@asu.edu wrote: Hello, I would like to take the mean of a column from a data frame and then bind the

  1   2   3   4   5   6   7   8   >