search for: topleft

Displaying 20 results from an estimated 177 matches for "topleft".

2011 Jul 13
1
Smart legend ???
Hi, all: Is there an automatic smart legend for R? Since my R code is running in a row, which will produce a bunch of R plots in a single run, some of the produced plots are really "ridiculous". Because my legend is fixed to "topleft", sometimes, which occludes the key parts of the figure/plots, but most of the time, the legend works just fine. I'm wondering is there a smart legend in R? Whenever I set "topleft" but occlude the actual plots, the smart legend may reset from "topleft" to "toprig...
2008 Oct 23
3
xy.coords in text
Hello, I want to add text annotation about correlation on "pairs" plots. I found that I could pass a function to the "panel" argument of pairs : panel.annot <- function(x, y, ...) { points(x, y, ...) c <- cor.test(x, y) legend("topleft", legend=substitute(rho == r, list(r=sprintf("%.2f", c$estimate))), bty="n") } And then : dat <- data.frame(a=rnorm(100), b=runif(100), c=runif(100)) # just random data pairs(dat, panel=panel.annot) It works fine. But what I plot is not really a legend, so I'...
2009 Aug 25
3
math symbol + value of a variable in legend.
Hi R users: I will like to have a legend with math symbols and also with the value of a variable. But I cannot obtain both at the same time (symbol + value of a variable): Here is a reproducible example: m1<-5 m2<-12 plot(1:5,1:5,type="n") legend("topleft",legend=c(paste(expression(mu),"=",m1),expression(paste(mu,"=",m2))),lty=1:2) Thank you for your help. Kenneth PD: Using R 2.9.2 on Linux ubuntu 2.6.28-15-generic #49-Ubuntu SMP Tue Aug 18 19:25:34 UTC 2009 x86_64 GNU/Linuxu
2009 Aug 25
3
math symbol + value of a variable in legend.
Hi R users: I will like to have a legend with math symbols and also with the value of a variable. But I cannot obtain both at the same time (symbol + value of a variable): Here is a reproducible example: m1<-5 m2<-12 plot(1:5,1:5,type="n") legend("topleft",legend=c(paste(expression(mu),"=",m1),expression(paste(mu,"=",m2))),lty=1:2) Thank you for your help. Kenneth PD: Using R 2.9.2 on Linux ubuntu 2.6.28-15-generic #49-Ubuntu SMP Tue Aug 18 19:25:34 UTC 2009 x86_64 GNU/Linuxu
2009 Dec 11
1
Array of legend text with math symbols from predefined variables
...xt in the legend, the following, although cumbersome, works for me: ? > LegendText = " 'U' [infinity], '=10 m/s' "?? # (read in from a file) ??> LegendName = paste("bquote(paste(",LegendText, "))") ? > plot( c(1,2,3), c(1,2,3) ) ? > legend(?topleft?,1, eval(parse(text=LegendName)) ) ?If I now have more than one line in a plot and hence want to include more than one line of legendtext, I run into problems because ? > legend(?topleft?,1, c( ?eval(parse(text=LegendName1)),eval(parse(text=LegendName2)) ?) will not result in evaluation of...
2011 Apr 29
3
Change the text size of the title in a legend of a R plot.
Hello, Is it possible to change the text size of the title in a legend of a R plot? I tried to directly change the title.cex argument but it seems not to work. Trying : Horizo <- c(1,2,6,10,20) legtext <- paste(Horizo,sep="") legend("topleft", legend=legtext,col=col,text.col=col,lwd=lwd, lty=lty,cex=1.1,ncol=3,title = "Horizons",title.col ="black",title.cex=1.4) gives the following error (sorry in french): Erreur dans legend("topleft", legend = legtext, col = col, text.col = col, : argument(s) i...
2006 Oct 13
3
Barplot legend position
Dear useRs, I'm trying to create a barplot like so: x=matrix(1:10,2,5) barplot(x,leg=c("left","right"),besid=T) The legend is placed in default position topright, however the data are plotted there too. I tried controlling the legend position by adding x="topleft" but this results in an error that x matches multiple formal arguments. Leaving out the legend and making a separate call to legend leaves out the colors of bars ... Please advice, Ingmar
2006 Nov 09
4
Plotting symbols with two positions?
...o positions as a symbol in a plot? All the best /CG On Thu, November 9, 2006 9:30 am, Dimitris Rizopoulos said: > try the following: > > x <- runif(100, -4, 4) > y <- 1 + 2 * x + rnorm(100, sd = 2) > fit <- lm(y ~ x) > > plot(x, y) > abline(fit) > legend("topleft", expression(paste(R[adj]^2, " = 0.66"))) > > ## or > > plot(x, y) > abline(fit) > legend("topleft", legend = substitute(R[adj]^2 == x, > list(x = summary(fit)$adj.r.squared))) > > > I hope it helps. > > Best, > Dimitris > >...
2008 Jul 29
4
Graphics function question
...x(startBReP3O1T), max(endBReP3O1T)) y <- seq(ymin, ymax, length = 10) plot(x,y, type = 'n', xlab = 'Age', ylab = 'BReP3O1T', main = 'Age, decline and BReP3O1T') segments(x0 = startage, x1 = endage, y0 = startBReP3O1T, y1 = endBReP3O1T, col = decline) legend('topleft', legend = c('Stable', 'Decline'), lty = 1, col = c(1,2)) >>>>> I would like to make this into a function. The only thing that changes is BReP3O1T. The problem is that sometimes this occurs as text (e.g. in ylab and main) sometimes after a $ (e.g. in the first t...
2007 Oct 30
1
Sweave line length
...f text that Sweave generates is longer than the right margin in my dissertation. I have found no way to tell Sweave how to set the line length. I am using an iMac with tiger ver. 10.4.10, and R: ver. 2.5.1. Here is the R code that is longer than my right margin: input to Sweave: legend("topleft",c("obs", "theo","hi","lo"),lty = c(1,2,3,4),col=c(1,2,6,4,0), cex=1.5,pt.cex=c(3,6), bty='o',inset=.05) output from Sweave: > legend("topleft", c("obs", "theo", "hi", "lo"), lty = c(1, 2, 3...
2007 Jun 08
2
legend + expression
...h expression in the legend of a plot and I haven't found the way to get this to work, so any help will be appreciate. Basically I want to include in the plot is the R-squared and its numerical value, so I tried this: R2c<-0.82879 # R-squared of calibration model plot(1:10,1:10) legend("topleft", legend=c(expression(R[c]^2==format(R2c,nsmall=2)))) Thanks for any hint PM
2010 Feb 04
3
Legend symbol?
..., "High Z Outlier", "Default","Exponential (used)") } else { leg.txt <- c("Data", "Statistical Outlier", "Spatial Outlier", "High Z Outlier", "Default (used)","Exponential") } legend("topleft", legend=leg.txt, col=c("black","yellow","red","orange","blue","black"), pch = c(16,16,16,16,1,1), cex=0.85 ) Thanks, Doug -- --------------------------------- Douglas M. Hultstrand, MS Senior Hydrometeorologist Metstat, Inc. Win...
2011 Feb 04
1
Can an xyplot() plus legend be saved as an Enhanced Windows Metafile (EMF)?
...ormat. This fails when xyplot() is used rather than plot(). Here is a simple example: require(lattice) a <- c(1:10) b <- c(2,4,5,2,3,5,7,8,9,5) # Output can be saved (or copied to the clipboard) as a Windows EMF image file # from the Graphics Device output window. plot(a , b) legend("topleft", "Test", title="Legend") # Output cannot be saved (or copied) as an EMF plot.new() xyplot(a ~ b) legend("topleft", "Test", title="Legend") I am using R version 2.12.0 (2010-10-15) on platform "i386-pc-mingw32" Thanks for any help...
2004 May 27
2
block diagonal matrix function
...tions: (1) Is there a better way to do this? (kronecker() isn't applicable here) (2) How do I generalize it to take an arbitrary number of matrices as inputs? TIV Robin "blockdiag" <- function (m1, m2, p.tr = 0, p.ll = 0) { ## p.tr and p.ll are padding values topleft <- m1 topright <- matrix(p.tr, nrow(m1), ncol(m2)) colnames(topright) <- colnames(m2) lowleft <- matrix(p.ll, nrow(m2), ncol(m1)) lowright <- m2 rbind(cbind(topleft, topright), cbind(lowleft, lowright)) } m1 <- structure(c(1, 1, 3, 1, 3, 4), .Dim = as.int...
2005 Oct 01
2
Multiple expressions, when using substitute()
expression() accepts multiple expressions as arguments, thus: plot(1:2, 1:2) legend("topleft", expression(y == a * x^b, "where "* paste(y=="wood; ", x=="dbh"))) Is there a way to do this when values are to be substituted for a and b? i.e., the first element of the legend argument to legend() becomes, e...
2011 Feb 10
1
Add different types of legend: line and points
...mean +/- SD") mn.t <- tapply(OrchardSprays$decrease, OrchardSprays$treatment, mean) xi <- seq(rb$n) points(xi, mn.t, col = "blue", pch = "*") h1 <- abline(h=110, col="red") h2 <- abline(h=0, col="red", lty="dotted") legend("topleft", c("110", "0", "mean"), lty = c("solid","dotted"), pch = c(" ", " ", "*"), col = c("red","red", "blue"),lwd = c(1,1)) (2) I then tried the following legend("t...
2010 Jul 24
1
Doubt about a population competition function
...20) n2<-k2-(beta*n10) if(t==0){plot(t, n10, type='b', xlim=range(c(1:t),c (1:t)), ylim=range(n10, n20), xlab='tempo', ylab='tamanho populacional') points(t, n20, type='b', col="red") points(t,n10,type="b", col="black") legend("topleft", c("Pop1","Pop2"), cex=0.8, col=c ("black","red"), pch=21:21, lty=1:1); } if(t>0){ for (i in 1:t){ n1[i==1]<-n1 n2[i==1]<-n2 n1[i+1]<-k1-alfa*n2[i] n2[i+1]<-k2-beta*n1[i] if(n1[i]==0){n1[i:t]==0} if(n2[i]==0){n2[i:t]==0} } plot(c(1:t)...
2004 Dec 02
3
Wishlist: simple legend options (PR#7400)
Full_Name: Elizabeth Purdom Version: 1.9.1 OS: Windows XP Submission from: (NULL) (171.64.102.199) It would be nice if legend had the option of some default locations you could choose instead of entering specific coordinates, like "topleft", "topright","topcenter", etc. based on par("usr") coordinates. I know I've wanted it so often I've made my own simple non-robust wrap-around, so I don't have to remember or parse the xjust and yjust options necessary to make it work. Of course there s...
2009 Jan 21
7
Panning map to a point vs. setCenter
Several map providers have functions to pan to a location, as opposed to the direct setCenter call. Panning animates the move from one point to another. To implement this in mapstraction, I created a panCenter function. I don''t know how to go about committing the change to svn, or who decides whether my naming convention is worthy, but I thought I''d share the function
2005 Jun 28
2
Producing character "given" i.e. "| " with plotmath
...), type = "l") ## Not what I want legend(legend = c(expression(L(y:mu))), x = "topright") ## Strange, is this a bug? legend(legend = c(expression(L(y|mu))), x = "top") ## Group produces an error legend(legend = c(expression(group(L(y, "|", mu)))), x = "topleft") ## Paste keeps commas in expression legend(legend = c(expression(paste(L(y, "|", mu)))), x = "bottomleft") ## This one is OK, but braces are not as they should be legend(legend = c(expression(paste("L(y", "|", "mu)"))), x = "bottom&qu...