Displaying 20 results from an estimated 4000 matches similar to: "legend + expression"
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
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
2009 Dec 11
1
Array of legend text with math symbols from predefined variables
Hello,
I am trying to include legend text with math symbols from a predefined
character variable that is read in from a file.
?
If there is only one line of text 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,
2010 Jul 11
1
difficulty with R expressions in text/legend
hi, i'm trying to prepend some plain (i.e. unevalutated) text to a
typographically evaluated R expression in a legend(...) call.
here's a working legend(...) call that is close to what i'd like
(where x and y are returned from an lm(...) call):
legend("topleft", legend = c(bquote(R^2 == .(summary(x)$r.squared)),
bquote(R^2 == .(summary(y)$r.squared))), fill =
2007 Mar 08
2
curve of density on histogram
Hi R users,
I would like to know why these following curve densities don't appear
correctly on the histograms.
Thank you for your help
library(lattice)
library(grid)
resp <- rnorm(2000)
group <- sample(c("G1", "G2", "G3", "G4"), replace = TRUE, size = 1000)
histogram(~ resp | group, col="steelblue",
panel = function(x, ...){
std
2010 Mar 12
3
rmaxwell in C
Hi R useRs:
How can I generate a random sample from Maxwell Distribution in C language?
Since I know the function rmaxwell {VGAM}, I tried the function r2c {r2c}.
But I still cannot find the source code.
Thanks for your kind help.
RegaRds,
2010-03-12
Randel
[[alternative HTML version deleted]]
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,
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
2007 Jun 14
4
question about formula for lm
Dear all;
Is there any way to make this to work?:
.x<-rnorm(50,10,3)
.y<-.x+rnorm(50,0,1)
X<-data.frame(.x,.y)
colnames(X)<-c("Xvar","Yvar")
Ytext<-"Yvar"
lm(Ytext~Xvar,data=X) # doesn't run
lm(Yvar~Xvar,data=X) # does run
The main idea is to use Ytext as input in a function, so you just type
"Yvar" and the model should fit....
2006 Feb 14
1
weird behavior of nsmall in format
>From the help page of format, nsmall should control the number of digits.
> format(0.123456789, nsmall = 10)
[1] "0.1234567890"
> format(0.123456789, nsmall = 1)
[1] "0.1234568"
> format(0.123456789, nsmall = 2)
[1] "0.1234568"
> format(0.123456789, nsmall = 8)
[1] "0.12345679"
It adds zeros fine but for
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
2011 Feb 04
1
Can an xyplot() plus legend be saved as an Enhanced Windows Metafile (EMF)?
I am trying to save some graphical output including a legend in the
Windows Enhanced Metafile (EMF) format.
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)
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
2011 Feb 10
1
Add different types of legend: line and points
Hello,
I plot box plot, and add a point to the box indicating mean. I also add some
range to the box width. I want to add legend for both the range (line) and
mean (point). However, I cannot add line legend and point legend together.
The code looks like the following.
(1) First, I tried the following code, however, it plot a line across the
point legend("*").
boxplot(count ~ spray,
2019 Jun 20
2
base::format adds extraneous whitespace for some inputs
Dear R Core Team,
First of all, thank you for your amazing work on developing and
maintaining this wonderful language.
I just stumbled upon the following behavior in R version 3.6.0:
format(9.91, digits = 2, nsmall = 2)
format(9.99, digits = 2, nsmall = 2)
yield "9.91" and " 9.99" with an extraneous whitespace.
My expected output for the second command is
2011 Jul 28
1
color of math annotation in legend
Dear useRs,
Can someone help me to adjust the color of math annotation in a legend? The
following code gives me a black "alpha = 2".
x=y=1:100
z=seq(0.5,50,by=0.5)
plot(x,y,type='l',col='black')
lines(x,z,col='red')
legend('topleft',c(expression(paste(alpha," = ", 1)),
expression(paste(alpha," = ",
2010 Feb 04
3
Legend symbol?
Hello,
I am creating a plot/image using different data and a couple fit lines
(see attached image). In the legend, I want the Default and Exponential
symbol to be a line. I am using the pch command, I tried to use "-" to
represent a line but does not work so I currently have set as a "1".
Any thoughts or suggestions would be greatly appreciated.
Below are the commands
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
2007 May 15
1
legend with mixed boxes and lines (not both)
Hi,
I seem to be unable to get a mixed legend that has lines *or* polygons
(not both). For example:
ppi <- seq(0,2*pi,length.out=21)[-21]
frame()
plot.window(ylim=c(-5,5),xlim=c(-5,5),asp=1)
polygon(cos(ppi)*4+rnorm(20,sd=.2),sin(ppi)*4+rnorm(20,sd=.2),
col="green",border=FALSE)
polygon(cos(ppi)*2+rnorm(20,sd=.1),sin(ppi)*2+rnorm(20,sd=.1),
col="blue",border=FALSE)
2009 Sep 25
2
Letra cursiva en legend()
Buenas tardes para todos,
Consideren la siguiente gráfica:
# Algunos datos
set.seed(123)
D <- matrix(rnorm(100), ncol = 2)
# Gráfico
matplot(D, type = ''l'', lty = 1, col = c(3,4),
las = 1, xlab = "Observación", ylab = ''Valores'')
# Leyenda
legend(''topleft'', c(''A1'',''A2''), text.col =