Displaying 20 results from an estimated 9000 matches similar to: "legend with mixed boxes and lines (not both)"
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 =
2007 Apr 22
1
dput/dget when a data frame has 2 rows (PR#9627)
This doesn't seem right; I'm using R version 2.4.1 (2006-12-18) on Mac OS
and Win XP and find the same issue:
> mydataframe <- data.frame(ppi=c(.5,.5),mmu=c(5,10))
> dput(mydataframe,"mydataframe.txt")
> dget("mydataframe.txt")
Error in attributes(.Data) <- c(attributes(.Data), attrib) :
row names must be 'character' or 'integer', not
2006 Oct 11
4
Object attributes in R
Hi,
I have questions about object attributes, and how they are handled when
subsetted. My examples will use:
tm <- (1:10)/10
ds <- (1:10)^2
attr(tm,"units") <- "sec"
attr(ds,"units") <- "cm"
dat <- data.frame(tm=tm,ds=ds)
attr(dat,"id") <- "test1"
When a "primitive class" object (numeric, character, etc.) is
2005 Aug 15
1
png and resolution (PR#8066)
Full_Name: Knut krueger
Version: 2.1.1
OS: xp Home
Submission from: (NULL) (149.225.134.34)
In the png function the value res seems to be inactive:
bmp(filename = "c:/r/Rplot%03d.bmp", width = 1920, height = 1920, pointsize =
48, bg = "white", res = 2400)
result:
witdh/heigth = 1920 <> 20.32 mm
ppi=2400
Results as expected
png(filename =
2012 Jun 25
1
special simbol (±) in a legend
dear reserachers,
I am looking for a expression about a special symbol (±) in a Legend and
add on front of "Mean ± SD" the symbol of bracket
sorry if the example is not great
disptest <- matrix(rnorm(10),nrow=10)
disptest.means<- rowMeans(disptest)
plot(1:10,disptest.means)
dispersion(1:10,disptest.means,(disptest.means+disptest
),(disptest.means-disptest
2009 Nov 30
1
Continuous legend colors
Dear List,
I am trying to get a basic plot to show a continuous range of fill colors. It is probably easiest to demonstrate. I would like a legend like in the following example:
Satellite.Palette <-colorRampPalette(c("blue3","cyan","aquamarine","yellow","orange","red"))
require(fields)
image.plot(volcano, col = Satellite.Palette
2011 Sep 20
3
Problem with legend
HI,
This code is part of a code I used to do a linear regression:
>points(var1~var2,data=Regress,pch=21,bg="grey")
>reg11<-lm(var1~var2,data=Regress)
>abline(lm(var1~var2,data=Regress),lty=2,lwd=2,col="grey")
>legend("topleft",legend=
>c("NDII from composite",
>"y= 0.0007x - 0.1156",expression(paste(r^2 ==
2012 Feb 22
1
line width in legend of interaction.plot
Dear R developers,
The following command produces an interaction plot with lwd=2.
interaction.plot(c(1, 2, 1, 2), c(1, 1, 2, 2), 1:4, lwd=2)
In the legend, however, lwd seems to be 1, which does not seem
to be intended behavior. Probably the lwd is not correctly forwarded
to legend:
from the interaction.plot source:
legend(xleg, yleg, legend = ylabs, col = col, pch = if (type %in%
2006 Apr 11
1
problems with assign
Hello.
I have n files in a directory: file1, ..., filen.
I read them with the following commands:
list=scan(file="list",what=list(nom=""))
# in the file list, I have all the filenames.
n=length(list[[1]])
for (i in 1:n){
aux <- paste("p",i,sep="")
assign(aux, as.matrix(read.table(list[[1]][i])))
}
R creates the matrices p1,p2,...,pn.
I want
2012 Feb 15
2
assign same legend colors than in the grouped data plot
Dear community,
I've plotted data and coloured depending on the factor variable v3.
In the legend, I'd like to assign properly the same colors than in the
factor (the factor has 5 levels).
I've been trying this but it doesn't work.
plot(var1, var2, xlab = "var1", ylab = "var2", col =var3 , bty='L')
legend(locator(1),c("level 1 var3",
2013 Jan 23
1
italic font for legend text when using expression function for symbols
Hello,
I'm trying to add a symbol (Delta) to plot legend with text using
"expression(paste())" but this disables the text.font that allows to use
bold or italic text.
as follows:
x=c(1:10)
y=c(1:10)
plot(x,y)
legend(1,10,legend=c("A","B","C",expression(paste(Delta, D))),
pch=c(24,18,17,16),cex=2,text.font=3,bty="n")
Any suggestion to
2008 Jun 13
1
Switching the order of legend boxes in a lattice bar graph
I suspect there is a simple solution to this problem, but have been
unable to find it. Below is some code that I have run to create 3
lattice graphs. I have been asked to change the legend so that the
'No' and dark blue are above "Y" and light blue in the legend to
mirror the stacked bars in the graph which feature dark blue above light blue.
I have tried changing the data
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
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
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
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,
2008 May 25
1
Using unicode with sprintf or paste in Windows (PR#11515)
Full_Name: Michael Toews
Version: 2.7.0
OS: Windows XP SP2
Submission from: (NULL) (24.80.163.230)
Using Unicode characters in Windows works with static strings (as of R 2.7.0),
however fails when used with sprintf() or paste(). For example, on R 2.7.0 for
Windows XP (SP2):
Static string (works, showing Greek Delta character):
> print("\u0394Q = 2.2 L/s")
[1] "ΔQ =
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 Aug 20
4
I have a problem with R!!
Dear all
i?m working with a program i?ve made in R (using functions that others
created)
to run my program i need a sample. if i generate the sample using for
example, rnorm(n, mu, sigma) i have no problem
but if i obtain a sample from a column in excel and i copy it, the program
says that there is a mistake: it says "Error en `[.data.frame`(data,
indices) : undefined columns