Hi,
last_plot() + scale_fill_grey()
should do it
HTH,
baptiste
On 10 March 2010 09:46, Johannes Graumann wrote:
> Hello,
>
> I'd like to sitch to a monochrome/bw color-palette for the filling of
> geom_bar-bars (produced via "qplot" as in the example below). Hours of
> googling didn't yield a
;
> thanks for your help, Joh
>
> On Wednesday 10 March 2010 10:29:05 baptiste auguie wrote:
>> Hi,
>>
>> last_plot() + scale_fill_grey()
>>
>> should do it
>>
>> HTH,
>>
>> baptiste
>>
>> On 10 March 2010 09:46, Johannes Gra
Thanks, it is indeed a bit cleaner. I was hoping for a more generic
solution but I guess people use cat() and sprintf() in such cases.
Thanks,
baptiste
On 10 March 2010 12:46, Berend Hasselman wrote:
>
>
>
> baptiste auguie-5 wrote:
>>
>>
>> This is a lot easier
&
# test - m is from original post
> write.mat(m, rep(c("%i", " %15.7e", "\n"), c(1, 6, 1)), file = "")
>
>
> On Wed, Mar 10, 2010 at 7:52 AM, baptiste auguie
> wrote:
>> Thanks, it is indeed a bit cleaner. I was hoping for a more gene
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 trelli
This will give you a greek character, see ?plotmath
grid.text(expression(mu*"(s,t)"), 0.5, unit(5, "lines"), vp=vp2)
The following works for me, it may be that you're using an outdated
version of R,
vp <- viewport(
x = unit(0, "npc"),
y = unit(0, "npc"),
just = c("left", "bottom"),
xscale
Hi,
I don't think the fill parameter can be a colour gradient. You'll need
to create small polygons, each with its own fill (200, say). Try this,
x= c(0, 0.5, 1)
y= c(0.5, 1, 0.5)
grid.polygon(x=x, y=y, gp=gpar(fill="grey90", col="grey90"))
xx <- seq(range(x)[1],range(x)[2], length=100)
yy <-
[I neglected to check some details in the previous post]
This one should work better,
library(grid)
x= c(0, 0.5, 1)
y= c(0.5, 1, 0.5)
grid.polygon(x=x, y=y, gp=gpar(fill=NA, col="grey90")) # outer shell
xx <- seq(range(x)[1],range(x)[2], length=100)
dx <- diff(xx) # width of clipped triangles
at I need to append this color-gradient triangle into
> a another Figure I'm working on. But when I try to do that, this wonderful
> triangle overwrites the other one. Have tried to append it with not much
> luck..
> Much appreciation to your help though!!!
>
> Kexin
>
>
Dear list,
Following a recent enquiry, I've been playing with the idea of creating a
colour gradient for a polygon, using the Grid package. The idea is to draw a
number of stripes of different colours, using the grid.clip function. Below
is my current attempt at this,
library(grid)
rotate.polyg
Is this what you want?
myfun <- function(x, a=19, b=21){ return(a * x + b) }
mysecond.fun <- function(a, b, cc=myfun, cc.args=list(a=2,b=15) ){
list(a=a, b=b, cc = function(x) cc(x, cc.args$a, cc.args$b))
}
mysecond.fun(a=1,b=2)$cc(x=12)
It may be that you're after a Curry (*) function, as in,
see also `%but%.character` in the operators package.
>rnorm %but% list( mean = 3 )
function (n, mean = 3, sd = 1)
.Internal(rnorm(n, mean, sd))
baptiste
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.
Following up on my previous post.
I've managed to have the function return a gList rather than plot everything
directly, but I get a rather obscure error message when I try to wrap the
grobs in a gTree with a rotated viewport,
Error in x$children[[i]] : attempt to select less than one element
ho
Dear list,
I'm manually editing a large collection of pdf files that I produced with R
in Adobe Illustrator. In doing so, I've had the surprise to see symbols
duplicated on top each other. The following code illustrates this,
pdf()
plot(1, xlab=expression(mu))
dev.off()
If I open this pdf in Ill
duplicated symbols
#system("cat testEps.pdf",int=T)
#system("cat testQuartz.pdf",int=T)
#system("cat testCairo.pdf",int=T)
2009/6/30 Dieter Menne
>
>
>
> baptiste auguie-5 wrote:
> >
> >
> > pdf()
> > plot(1, xlab=expr
2009/7/1 miguel bernal
> I think there is a package to visualize the links between
> functions in a package, but I don't know its name (if anybody knows it, I
> will love to know it).
reminds me of roxygen's callgraph (relies on graphviz), is that what you
meant?
baptiste
[[alternativ
For another generic approach, you might be interested in the Reduce
function,
rolling <- function( x, window=seq_along(x), f=max){
Reduce(f, x[window])
}
x= c(1:10, 2:10, 15, 1)
rolling(x)
#15
rolling(x, 1:10)
#10
rolling(x, 1:12)
#10
Of course this is only part of the solution to the
I've never tried it but I would have thought the package DescribeDisplay can
help you,
http://www.ggobi.org/describe-display/
baptiste
2009/7/3 David Winsemius
>
> On Jul 3, 2009, at 1:35 PM, Veerappa Chetty wrote:
>
> Hi , I have created a parallel coordinate plot using rrgobi. I like to
>>
?strip.custom
p <-
xyplot(acet+chol+ino+acetp ~ zp,
group=grp,
data=data,
type="l",
scales=list(relation="free"),
auto.key=list(title="
>
> Neurotransmitters", border=TRUE))
update(p, strip=strip.custom(factor.levels=letters[1:4]))
HTH,
baptiste
2009/7/3
>
Hi,
You could use ?rect
x = 1:5
y=1:5
plot(x,y,t="n",xaxs="i")
abline(h=y)
xlims = range(x)
y.rect = matrix(rep(y,each=2)[-c(1, 2*length(y))], ncol=2, byrow=T)
x.rect = matrix(rep(xlims), ncol=2,nrow=nrow(y.rect), byrow=T)
cols = 1:4
rect(x.rect[,1], y.rect[,1], x.rect[,2], y.rect[,2],col=
Hi,
you could try the reshape package,
l = list(d1= data.frame(ID=letters[1:4],value=1:4),
d2= data.frame(ID=letters[1:4],value= -c(1:4)))
library(reshape)
m = melt(l)
cast(m, .~ID, fun=mean)
HTH,
baptiste
2009/7/15 Mark Na
> Dear R-helpers,
> I have a list containing 5000 elemen
Alternatively, you could make use of transparency (on some devices), or use
ggplot2 to map the number of observations to the point size,
d =
read.table(textConnection("
x y
1 10
1 10
2 3
4 5
9 8
"),head=T)
library(ggplot2)
# transparency
qplot(x, y, data=d, al
try this,
do.call(rbind, tmp)
baptiste
2009/7/17 Angel Spassov
> Dear useRs and developeRs,
>
> I am struggling with a simple but not obviously solvable issue. Suppose I
> have the following list of data.frames called 'tmp':
>
> a <- data.frame(a=rnorm(10),b=letters[1:10])
> (tmp <- list(a,a[1
?scale_fill_discrete()
qplot(x,y,data=data.frame(x=1,y=1,f="a"),fill=f) +
scale_fill_discrete("test")
baptiste
HTH,
2009/7/21 rajesh j
> Hi,
>
> I've used the following command in qplot
> qplot(a$V1,geom="histogram",binwidth=0.15,fill =
> factor(a$V2),ylab="Frequency",xlab="Rate");
> but the
try this,
library(ggplot2)
ggplot() + geom_histogram(aes(x=rnorm(100), fill=..count..))+
xlab(NULL)+
scale_y_continuous("")+
opts(legend.position="none")
HTH,
baptiste
2009/7/22 RON70
>
> I have following code on "qplot" :
>
> library(ggplot2)
> ggplot() + geom_histogram(aes(x=rnorm(100), fi
Try with ?segments,
x<-seq(75,225,0.1)
plot(x,dnorm(x,mean=140, sd=15), type='l', col='navy')
#abline(v = 149, col = "black")
segments(149, 0, 149, dnorm(149,140,15))
curve(dnorm(x,mean=150, sd=15),from=75, to=225, col='orange', add=TRUE)
HTH,
baptiste
2009/7/26 Mary A. Marion
> Hello,
>
>
several options are listed here:
http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:display-images
baptiste
>
> Rainer M Krug schrieb:
>>
>> Hi
>>
>> while teaching R, the question came up if it would be possible to add
>> a picture (saved on the HDD) to a graph (generated by plot()
essentially the same,
object1 = object2 = object3 = data.frame(Distance = 1:10)
foo = function(o){
within(get(o), LogDist <- log10(Distance))
}
my.objects = paste("object", 1:3,sep="")
lapply(my.objects, foo)
It is however advisable to group the initial objects
Hi,
Chapter 8 of the lattice book has some examples (you can see the code
and figures on r-forge). Perhaps you could try something like this,
d = data.frame(x=1:10,y=1:10,f=sample(letters[1:2],10,repl=T))
axis.custom = function(side, ...){
if(side == "bottom")
switch(pa
Hi,
Try this,
plot(1:5,1:5, t='p', pch=paste(1:5))
baptiste
2009/7/30 amna khan :
> Dear Sir
>
> I want to write the numbers 1,2,3,on a scatter plot instead of points,
> like 1 corresponding to first point on plot, 2 corresponding second point
> etc.
> Help in this regard.
>
> Regards
>
>
Try this,
files = paste('pred/Pred_pres_', letters[1:6], '_indpdt',sep="")
lapply(files, load)
HTH,
baptiste
2009/7/30 waltzmiester :
>
> I am trying to load binary files in the following fashion
>
> load("pred/Pred_pres_a_indpdt")
> load("pred/Pred_pres_b_indpdt")
> load("pred/Pred_pres_c_ind
to 9 remaining points were
> marked by 1. I want to have numbers 1 to 22 instead of points on scatter
> plot.
> Suggest more.
> Kind Regards
> On Thu, Jul 30, 2009 at 11:57 PM, baptiste auguie
> wrote:
>>
>> Hi,
>>
>> Try this,
>>
>> plot(1:5,1:5
Hi,
you want only the x scale to be free,
xyplot(place~rank|type, data=df1,
panel= function(x, y, ..., subscripts)
{
panel.xyplot(x,y,..., subscripts)
require(grid)
panel.grid(h = -1,v = 0, lty="dotted")
grid.text(unit(x,"native"),
Try this,
formatC(d %% 1e5, width=5, flag = "0", mode="integer")
[1] "00735" "02019" "04131" "04217" "04629" "04822" "10115" "11605" "14477"
[10] "15314" "15438" "19040" "19603" "22735" "22853" "23415" "24227" "24423"
HTH,
baptiste
2009/7/31 PDXRugger :
>
>
> I would like to recreate "data"
try this one,
`%ni%` <- Negate(`%in%`)
Best,
baptiste
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-c
> What's wrong with using grid.grabExpr?
>
> p1 <- xyplot(1:10 ~ 1:10)
> g1 <- grid.grabExpr(print(p1))
>
> I can imagine there would be potential problems to do with the
> plot-time aspect and layout calculations...
>
>
>
> On 19 March 2010 21:51, b
Hi,
On 24 March 2010 23:22, Paul Murrell wrote:
> Hi
>
> baptiste auguie wrote:
>>
>> Thanks Felix and Paul. I had overlooked grid.grabExpr, assuming that
>> one had to draw on a device before grabbing the output.
>>
>> Now I'm not sure if there'
Hi,
One option with Grid graphics,
m <-
matrix(c( 1667,3,459,
2001, 45, 34,
1996, 2,5235),
dimnames=list(c("Eric & Alan", "Alan","John & David")),
ncol=3, byrow=T)
## install.packages("gridExtra", repos="http://R-Forge.R-project.org";)
library(gri
Hi,
Barry suggested a way to place the text labels; I would like to point
out the grid.curve() function that might help in connecting the labels
with nice-looking curves. I don't know of a base graphics equivalent
(xspline() might come close) so it might be best to opt for Grid.
HTH,
baptiste
w()
grid.arcText(labels=labels)
On 7 April 2010 16:44, Gabor Grothendieck wrote:
> There is draw.arc in the plotrix package.
>
> On Wed, Apr 7, 2010 at 10:20 AM, baptiste auguie
> wrote:
>> Hi,
>>
>> Barry suggested a way to place the text labels; I would like to
, SIMPLIFY=FALSE))
gTree(children=gList(g1, g2, g3),
outer.radius=convertUnit(radius, "npc") +
convertUnit(max(stringWidth(labels)), "npc"))
}
grid.arcText <- function(...)
grid.draw(arcTextGrob(...))
set.seed(1234)
grid.newpage()
grid.arcText()
try this,
install.packages("expm", repos="http://R-Forge.R-project.org";)
On 8 April 2010 17:28, arindam fadikar wrote:
> On Thu, Apr 8, 2010 at 5:38 PM, David Winsemius wrote:
>
>>
>> On Apr 8, 2010, at 1:45 AM, arindam fadikar wrote:
>>
>> Dear users,
>>>
>>> How to get a symmetric square roo
Hi,
On 12 April 2010 22:07, Peter Jepsen wrote:
>
> 3. Are there R packages that can "draw tables"?
the gplots package has a textplot() function, and the gridExtra
package a tableGrob(),
http://rwiki.sciviews.org/doku.php?id=tips:graphics-grid:table
In theory it should be possible to adapt the
I have seen pdf files with 3D objects embedded in it, using the U3D format,
http://en.wikipedia.org/wiki/Universal_3D
but I don't think there's a device for this in R; in fact there may
not even exist a third-party post-processing route available at this
time to bridge the gap between rgl and this
t;
> luke
>
>
> On Thu, 15 Apr 2010, baptiste auguie wrote:
>
>> I have seen pdf files with 3D objects embedded in it, using the U3D
>> format,
>> http://en.wikipedia.org/wiki/Universal_3D
>>
>> but I don't think there's a device for this in R; in f
Hi,
Another option might be the tikzDevice package, which uses LaTeX to
process the fonts,
library(tikzDevice)
tikz(standAlone=T)
plot(1,1, type = 'n')
mtext(side = 3, line = 2, "$\\mu$")
dev.off()
## system("/usr/texbin/pdflatex Rplots.tex")
HTH,
baptiste
On 20 April 2010 07:30, Prof Brian R
Hi,
Taking a wild guess, it looks to me that you might have overlaid
several times the same text,
plot.new()
text(0.5,0.5,rep("test",10))
HTH,
baptiste
On 20 April 2010 08:54, chrisli1223 wrote:
>
> Hi all,
>
> I have written a note near each of my graphs using mtext.
> mtext(text,side=1,line
Hi,
This idea was also discussed when Paul Murrell first announced the
grid.raster function to R-devel,
http://tolstoy.newcastle.edu.au/R/e8/devel/09/12/0912.html
My personal conclusion was that vector fill patterns are generally
better in terms of resolution and speed. Of course the situation mi
Hi,
try ?as.layer in the latticeExtra package.
HTH,
baptiste
2009/9/24 Larry White :
> I have two xyplots that i want to superimpose (code below). By default they
> are displayed on slightly different y scales (one runs from 10 to 25, the
> other from 10 to 30). I would like to force them both
Try this,
testFun <- function(x,y) plot(x,y, main=paste("plot
of",deparse(substitute(x)),"and", deparse(substitute(y))) )
a1 <- 5:8
b1 <- 9:6
testFun(a1,b1)
?deparse
HTH,
baptiste
2009/9/24 Wolfgang Raffelsberger :
> Dear guRus,
> I'd like to learn how to make a function recognize the name
Try these three options,
dp <- c(1,4,3,2,5,7,9,8,9,2)
tp <- 1:10
group <- factor(c(1, 2, 1, 2, 1, 3, 1, 3, 3, 2), label=letters[1:3])
plot(tp,dp, type= 'p', col = group)
d <- data.frame(dp=dp, tp=tp, group=group)
library(lattice)
xyplot(dp~tp, data=d, groups=group, auto.key=TRUE)
library(
OK, it makes sense. Let's try that.
Best,
baptiste
2009/9/25 Paul Murrell :
> Hi
>
>
> baptiste.auguie wrote:
>>
>> (Sorry about the double post earlier, googlemail is having hiccups today)
>>
>> 2009/9/24 Romain Francois :
>>>
>>> Why just grid ? why not a list for all kind of graphics ?
>>
>>
2009/9/25 Felix Andrews :
> Sorry, doubleYScale is not appropriate, since you specifically want a
> common y scale.
>
> I think Baptiste was suggesting to use layer(), rather than
> as.layer():
Truth be told, I wasn't quite sure what the initial request meant. I
took it quite literally, as "superi
126.733 2.414 135.450
grid.newpage()
system.time(table2(content))
# user system elapsed
# 22.387 0.508 24.457
grid.newpage()
system.time(table3(content))
# user system elapsed
# 4.868 0.124 5.695
dev.off()
### code ends ###
#system("open test-layout.pdf")
Hi,
it works for me with plyr version 0.1.9. Try upgrading to the latest
version, or post your sessionInfo()
HTH,
baptiste
2009/9/25 Veerappa Chetty :
> Hi,I am using the amazing package 'plyr". I have one problem. I would
> appreciate help to fix the following error: Thanks.
> ___
Hi,
I just tried a fourth variant, closer to what ggplot2 uses (I think):
to each grob is assigned a viewport with row and column positions (in
my example during their construction, with ggplot2 upon editing), and
they're all plotted in a given grid.layout. The timing is poor
compared to pushing a
Hi,
I think you are feeding two expressions to xlab instead of one.
Try this instead,
xyplot(y ~ x, dat,xlab=expression("Moran's " * italic(I)))
HTH,
baptiste
2009/9/26 Andrewjohnclose :
>
> Hi all, can anyone suggest a reason as mto why my xlab is plotting this text
> at oposite ends of axi
Hi,
You said,
>sumstats <- c(mean,sd)
>sumstats[1]
>#Gives this error
but this is not an error! You created a list that contains two
functions, and sumstats[1] simply prints the first one.
HTH,
baptiste
__
R-help@r-project.org mailing list
https://s
Dear list,
The dichromat package defines a dichromat function which "Collapses
red-green color distinctions to approximate the effect of the two
common forms of red-green colour blindness, protanopia and
deuteranopia."
library(dichromat)
library(grid)
colorStrip <-
function (colors = 1:3, draw
Try this,
library(ggplot2)
apply(matrix(10*rnorm(10),2), 1, ggplot2::rescale)
HTH,
baptiste
2009/9/28 Dry, Jonathan R :
> Hello all
>
> I have a data frame representing a matrix of data. For each of my variables
> (rows) I want to scale the data between 0 (representing the minimum value in
Also, have a look at each() in the plyr package,
library(plyr)
each(length, mean, var)(rnorm(100))
baptiste
2009/9/28 trumpetsaz :
>
> I am trying to write a function that will have an input of a vector of
> functions. Here is a simplistic example.
> sumstats <- c(mean,sd)
> sumstats[1]
> #Give
Not answering your question, but just pointing out the example of
base::.NotYetImplemented()
essentially doing the same thing.
Best,
baptiste
2009/9/28 Rolf Turner :
>
> I have vague recollections of seeing this question discussed on r-help
> previously, but I can't find the relevant postings
Hi,
Try opening and closing the device outside the loop,
pdf("D:/research/plot.pdf")
for (i in 1:n) {
plot(mon, mu, type ='o')
}
dev.off()
HTH,
baptiste
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do re
Hi,
I guess you want ?assign
See also this page for a working example,
http://wiki.r-project.org/rwiki/doku.php?id=guides:assigning-variable-names
HTH,
baptiste
2009/9/29 David Young :
> Hello All,
>
> I'm a new R user and have a question about what in SAS would be called
> macro variable sub
2009/9/30 lith :
>> Yes. You can get back the tick marks with scaless$col:
>
> Thanks for the hint. May I kindly ask what would be the easiest way to
> draw a line on the left side?
Try this,
mpanel = function(...) { grid.segments(0,0,0,1) ; panel.bwplot(...) }
bwplot(y~x, data=data.frame(y=rnor
code for colour and fill
regular expressions...
baptiste
2009/9/28 baptiste auguie :
> Dear list,
>
> The dichromat package defines a dichromat function which "Collapses
> red-green color distinctions to approximate the effect of the two
> common forms of red-green colour b
Hi,
assuming v is sorted, try this,
v[ findInterval(x,v)+0:1 ]
see ?findInterval and perhaps ?cut
HTH,
baptiste
2009/9/30 Corrado :
> Dear list,
>
> I have a strange requirement I have a vector, for example v<-
> c(0,0,0,0,1,2,4,6,8,8,8,8). I have a value,for example x<- 4.8.
>
> I wou
Dear list,
I know I have seen this discussed before but I haven't been successful
in searching for "ellipsis", "dots", "..." in the archives. I would
like to filter "..." arguments according to their name, and dispatch
them to two sub-functions, say fun1 and fun2. I looked at lm() but it
seemed mo
2009/10/1 Peter Ruckdeschel :
>
> removed <- c("lty",params.fun1)
> ## I assume you do not want to pass on argument "lty"...
> dots.remaining <- cl[-1] ### remove the function name
> dots.remaining <- dots.remaining[! names(dots.remaining)
> %in% removed]
>
> Be
Hi,
I know of three options that resemble your query,
- the roxygen package
- a ruby script called weeder by Hadley Wikham
- the inlinedocs package on r-forge
I only ever used roxygen though, so i can't speak for the relative
merits of the others.
HTH,
baptiste
2009/10/1 Steve Lianoglou :
Dear list,
I have the following function,
sugar = function(fun, id = "id"){
ff <- formals(fun)
if( id %in% names(ff))
stop("id is part of args(fun)")
formals(fun) <- c(unlist(ff), alist(id=))
fun
}
which one may use on a function foo,
foo = function(x){
x
}
sugar(foo) # results i
Hi,
You cannot start with a "*" in expression(). Try this,
plot(x~y,ylab=expression(~degree~C))
or even, as a short-cut,
plot(x~y,ylab=~degree~C)
HTH,
baptiste
2009/10/2 e-letter :
> Readers,
>
> I have tried to use a plotmath command to add the temperature degree
> sign (i.e. ᵒ C) to the
Hi,
It looks like lattice or ggplot2 might make this easier, but I'm not
entirely sure I understood the problem, short of an example.
Best,
baptiste
2009/10/2 Duncan Murdoch :
> On 02/10/2009 4:07 AM, Ben Kenward wrote:
>>
>> Hi,
>>
>> Is there a way to set the scale of a plot (i.e. number of a
try this,
plot(x~y,ylab=expression(~degree~C),xlab=expression(x[2]~"%"))
baptiste
2009/10/2 e-letter :
> Readers,
>
> I am unable to plot a label consisting of both subscript text and
> percentage (%) symbol:
>
> x<-(1:10)
> y<-(200:191)
> plot(x~y,ylab=expression(~degree~C),xlab=expression(x[2
::as.alist.symbol(id)
formals(fun) <- c(unlist(ff), new.arg)
fun
}
foo = function(x, a=1){
x
}
sugar(foo)
sugar(foo, 'a')
sugar(sugar(foo))
sugar(foo, 'my.new.arg')
Best,
baptiste
2009/10/1 baptiste auguie :
> Dear list,
>
> I have the following function,
Hi,
Try this,
dev.new()
layout(matrix(1:4,2, by=T))
plot(1:10,main="top left plot")
plot(1:10,main="top right plot")
plot(1:10,main="bottom left plot")
plot(1:10,main="bottom right plot")
for (ii in 1:2){
for (jj in 1:2){
par(mfg=c(ii,jj))
text(5,2, lab=paste("plot #:",ii,",",jj,sep=""))
}
}
pa
portant incompatibility in complicated
layouts, but it seems to work at least for simple ones.
Best regards,
baptiste
2009/10/4 baptiste auguie :
> Hi,
>
> Try this,
>
> dev.new()
> layout(matrix(1:4,2, by=T))
>
> plot(1:10,main="top left plot")
> plot(
Hi,
Whether or not what follows is to be recommended I don't know, but it
seems to work,
p <- ggplot(diamonds, aes(carat, ..density..)) +
geom_histogram(binwidth = 0.2)
x = quote(cut)
facets = facet_grid(as.formula(bquote(.~.(x
p + facets
HTH,
baptiste
2009/10/5 Bryan Hanson :
> Thanks
Now why do I always come up with a twisted bquote() where a simple
paste() would do!
Thanks,
baptiste
2009/10/5 hadley wickham :
>> Whether or not what follows is to be recommended I don't know, but it
>> seems to work,
>>
>> p <- ggplot(diamonds, aes(carat, ..density..)) +
>> geom_histogram(b
Hi,
Try this,
> x= "my title"
> plot(1,1, main = bquote(italic(.(x
HTH,
baptiste
2009/10/6 Jacob Kasper :
> Part of my script reads:
>
> speciesName <- names(data)[i]
> plot(year,depth, xlab="Year",
> ylab="Depth(m)",main=expression(italic(paste(speciesName))) )
>
> Unfortunately, this jus
Hi,
I may be missing an important design decision, but could you not have
only a single data.frame as an argument of your function? From your
example, it seems that the colour can be mapped to the fac1 variable
of "data",
compareCats <- function(data) {
require(ggplot2)
p <- ggplot(data, a
t;lrg", "lrg", "sm", "sm"), 25)))
compareCats(data = test)
rem <- sample(10, 1:ncol(test)) # randomly remove a few points here and there
last_plot() %+% test[-rem, ] # replot with new dataset
HTH,
baptiste
2009/10/6 baptiste auguie :
> Hi,
>
&
Hi,
2009/10/6 John Kane :
> How do I suppress the numbers on the x-axis?
>
Try this,
p + opts(axis.text.x = theme_blank())
HTH,
baptiste
> Thanks
>
>
> __
> [[elided Yahoo spam]]
>
> ___
Thanks very much.
>
>
>
> --- On Tue, 10/6/09, baptiste auguie wrote:
>
>> From: baptiste auguie
>> Subject: Re: [R] ggplot equivalent of par(xaxt)
>> To: "John Kane"
>> Cc: "R R-help"
>> Received: Tuesday, October 6, 2009, 2:57 PM
&
Hi,
Your two data sets have a different year so I'm not sure what you want
to do with the x axis.
The code below plots both data sets on the same graph, with a range of
two years,
d1 <- read.table("~/Downloads/2005.txt")
d2 <- read.table("~/Downloads/2006.txt")
cleanup <- function(d){
names
Hi,
Like this perhaps?
> slope = diff(y) / diff(x)
> str(slope)
num [1:499] 1.5068 -1.8406 2.1745 0.0676 -2.6088 ...
HTH,
baptiste
2009/10/8 FMH :
> Dear All,
>
> Let 499 piece-wise lines were buit up by 500 pair of observations, via R
> code below.
>
> x <- 1:500
> y <- rnorm(500)
> plot(x
Hi,
Try the useOuterStrips function in the latticeExtra package.
HTH,
baptiste
2009/10/8 Christian Ritter :
> Dear all,
>
> I want to split the strips in xyplot and push them into the margins ...
>
> Tried to find this in common documentation (such as Deepayan's book) on
> lattice ... but so f
Dear all,
In mucking around with ggplot2, I've hit the following snag,
library(ggplot2)
# this returns a grob, OK
GeomAbline$icon()
# lines[GRID.lines.9]
# this returns the function icon, OK
GeomAbline$icon
# proto method (instantiated with ): function (.)
# linesGrob(c(0, 1), c(0.2, 0.8))
#
... without answering my previous question, I have just found a
fortune-hate workaround,
getIcon <- function(geom){
st <- paste("Geom", firstUpper(geom),"$icon", sep="")
eval(parse(text=st))
}
getIcon("abline")
I'm still curious about the get() behaviour though.
Best,
baptiste
__
Hi,
with assign,
foo <- function(var){
assign("var", var+1, envir = .GlobalEnv)
}
var =1
foo(2)
var
# [1] 3
HTH,
baptiste
2009/10/8 devol :
>
> Dear all,
>
> could you please advice whether it is possible somehow to modify an
> external (from the point of some function view) variable by
Hi,
I think this is a case where you should use the ?"[[" extraction
operator rather than "$",
d = data.frame(a=1:3)
mytarget = "a"
d[[mytarget]]
HTH,
baptiste
2009/10/11 tdm :
>
> Hi,
>
> I am passing a data frame and field name to a function. I've figured out how
> I can create the formula
Hi,
the abind package can help you with the first query,
## add values
library(abind)
arr <- abind(arr,arr[1,,,] * 2 + 1,along=1)
dim(arr)
as for the second, maybe you can use negative indexing,
## remove values
arr <- arr[-2,,,]
HTH,
baptiste
2009/10/11 ampc :
>
> Manipulating Arrays
> Usin
rom: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
>> project.org] On Behalf Of baptiste auguie
>> Sent: Sunday, October 04, 2009 3:33 AM
>> To: r-help
>> Subject: Re: [R] add lines() to 1st plot in layout() after calling 2nd
>> plot()?
>>
>> Hi,
>>
Hi,
You'll probably find that there are two parts to your query:
1- import a bitmap into R, for this I'd suggest the wiki page,
http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:display-images
2- place the image (now some sort of matrix of colour points) at
different locations on a
Hi,
I don't know if it helps, but looking at the output of xyplot you can
extract the legend (a grid.frame) as follows,
library(grid)
library(lattice)
p = xyplot(x~y, group=x,data=data.frame(x=1:10,y=1:10),
auto.key=list(space="right"))
legend = with(p$legend$right, do.call(lattice:::drawSimpleK
Dear list,
I have the following text to parse (originating from readLines as some
lines have unequal size),
st = c("START text1 1 text2 2.3", "whatever intermediate text", "START
text1 23.4 text2 3.1415")
from which I'd like to extract the lines starting with "START", and
group the subsequent fi
fy = rbind)
>> s
> text1 text2 text3
> [1,] "1" "2.3" "5"
> [2,] "23.4" "3.1415" "6"
>
> If there are non-START fields that do match pat then grep out the
> START fields first.
>
> On Mon,
Hi,
>From ?par,
"Value
When parameters are set, their former values are returned in an
invisible named list."
Therefore opar <- par(col="red") will not contain col="red".
HTH,
baptiste
2009/10/27 Janke ten Holt :
> This seems to work indeed. But I don't understand why... I would think
> tha
Hi,
>From ?read.csv
"Alternatively, file can be a readable text-mode connection (which
will be opened for reading if necessary, and if so closed (and hence
destroyed) at the end of the function call)"
HTH,
baptiste
2009/10/27 Peng Yu :
> I don't understand why I can not close 'f'. This may b
Hi,
Try this,
files <- paste("RA94010",1:3,sep="")
# or files <- list.files(pattern = "RA94010")
list.of.data <- lapply(files, read.table, header=F)
# if required, collapse into a single data.frame
do.call(rbind, list.of.data)
HTH,
baptiste
2009/10/28 Sybille Wendel :
> Dear all,
>
> I have
101 - 200 of 738 matches
Mail list logo