similar to: Legend containing maths symbol and values of variables

Displaying 20 results from an estimated 2000 matches similar to: "Legend containing maths symbol and values of variables"

2009 Apr 08
1
Colour each letter of a text string in a plot
I am inserting a DNA sequence into a plot, and hope to colourize each of the four nucleotide of the DNA sequence with a unique colour i.e., A ("red"), C ("green"), G ("blue", and T ("yellow"). I use the following codes, but the DNA sequence only shows as "red" DNA <- "ACGT" plot(1, xlim = c(0,1), ylim = c(0,1), axes=F,
2009 Mar 24
3
Summarizing each row into a frequency table
I have a matrix containing -1, 0, 1, however certain rows will not have all 3 numbers. I have written some codes to compute the frequency table of how many -1s, 0s, 1s per row, but it is very ugly and not efficient if there are more than 3 numbers. Please suggest. m <- rbind(sample(0:1, replace=T, 10), sample(-1:1, replace=T, 10)) m.table <- t(apply(m, 1, function(x) c(sum(x==-1, na.rm=T),
2009 Feb 22
2
How to reshape this data frame from long to wide ?
I tried cast and melt in reshape package, but still can't convert this data frame m m [,1] [,2] [1,] "A" "1" [2,] "A" "2" [3,] "B" "3" to this form. m1 [,1] [,2] [1,] "A" "B" [2,] "1" "3" [3,] "2" NA Please help. [[alternative HTML version deleted]]
2009 Mar 14
2
gsub and regex to tidy comma-limited values
I am cleaning up comma-limited values, so that only one comma separates each value. Using the example below, as much as I try with regex, I can't remove the last comma. I hope to have a one-liner solution, if possible. gsub("^,*|,*$|(,)*", "\\1", ",,,apple,,orange,,,,,lemon,strawberry,,,,") [1] "apple,orange,lemon,strawberry,"
2009 Feb 22
2
How to parse text file into a table?
I am given a text file of records to be converted into a table format. I have searched related topics or packages, but can't find any similar cases. Please help. Sample record is given below. Take note the last element doesn't have a semi colon. ###---------Start of record---------------------- Name : John Height: 170cm Weight : 70kg Age: 30 Status: Married Children: 2 Employment
2023 Mar 06
1
legend: interplay between title and y.intersp
Hi, I think you are right, legend cannot do it. I have now created my own legend function where I changed only one line and now it works the way I want it to. But I'm not sure if that might not have other side effects. I have the impression that the legend and the title start at the same y-position (try y.intersp=0). Only if y.intersp is big enough, then it leads to a non-overlap of
2003 Dec 12
1
legend() graphics output bug (PR#5725)
Full_Name: Daniel Gasser Version: 1.8.1 OS: Win XP Submission from: (NULL) (130.60.20.92) The legend()-Function shows a different behaviour than it did in Version 1.6.1. It plots a black box left of the legend lines on each legend row. In 1.6.1 there was just the line in appropriate color for each row in the legend (i was using exactly the same legend statement and same plot function). My legend
2009 Apr 22
1
Subsetting a vector of numerics such that standard deviation is less than 0.5 ?
> set.seed(999) > abs(rnorm(20)) [1] 0.28174016 1.31255963 0.79518398 0.27007049 0.27730642 0.56602374 1.87865826 1.26679114 0.96774968 1.12100936 1.32546371 0.13397739 0.93874945 [14] 0.17253810 0.95765045 1.36268625 0.06833513 0.10065765 0.90134475 2.07435711 > v <- abs(rnorm(20)) > v [1] 1.2285633 0.6430443 0.3597629 0.2940356 1.1252685 0.6422657 1.1067376 0.8848404 1.5540951
2009 Feb 22
2
Convert a list to matrix
I would like to convert a list to matrix. This can be easily achieved via do.call. The only problem is each element of the list has different length, which causes the recycling of values. How can I have NA instead of recycled values ? m <- list() m[["A"]] <- 1 m[["B"]] <- 2:3 do.call(rbind, m) [,1] [,2] A 1 1 B 2 3 [[alternative HTML version deleted]]
2023 Mar 04
1
legend: interplay between title and y.intersp
Set the legend position explicitly with x and y values and add xpd = TRUE to the legend call to clip the plot to the figure region and not the plot region (the default). Something like this (you may have to fool around with y.intersp, etc. to allow enough space between the legend lines): plot(c(0,1), c(0,1), type="n") legend(x = .4, y = 1.25, legend=c("", "",
2023 Mar 06
1
legend: interplay between title and y.intersp
What about plot(c(0,1), c(0,1), type="n") legend("top", legend=c("", "a", ""), col=c("blue", "red", "green"), title="test", y.intersp=c(1,-0.4), lwd=1) (in recent versions of R) Best, Uwe On 06.03.2023 11:34, Sigbert Klinke wrote: > Hi, > > I think you are right, legend cannot do
1999 Sep 11
1
legend(): adjust space between symbol and tex
Hello, I'd like to ask, how to adjust the space between symbol/line and text in a legend. My legend() is build like that legend(xmax-netzdiff/11, # shouldn't matter here ifelse(ydiff>=0, # ymin-6.5*(netzdiff/11), # ymax-netzdiff/11), # c("stehender Stamm","Windwurf",
2009 Mar 23
1
Capitalizing first letter of word or phrase
I managed to find toupper() which translates all letters to uppercase. Is there a function to capitalize only the first letter of word or phrase ? Thanks
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
2023 Mar 04
1
legend: interplay between title and y.intersp
Hi, my MWE is not working as expected: plot(c(0,1), c(0,1), type="n") legend("top", legend=c("", "", "a"), col=c("blue", "red", "green"), title="test", y.intersp=0.2, lwd=1) The lines are not below the title. I want (nearby) lines as in the plot, but below the title. Is there a way to achieve this?
2009 Feb 28
2
Review my upgrade plan from 2.8.0 to 2.8.1
Hi, On my laptop, R is installed on windows XP SP2 at D:\Program Files\R\R-2.8.0, and all add-on packages are installed at D:\Program Files\R\R-2.8.0.libs. In addition, I have created two environment enviroment to ease upgrading and installation of packages. Packages installed is a mix of those from CRAN, Bioconductor and local zips. D:\My Document\My Desktop>echo %R_HOME% D:/Program
2011 Oct 19
1
Square ended segments
Good Afternoon R Community, I am working on plotting behavior codes over short durations of time (a few seconds at a time over 1-2 hrs). I am utilizing as.POSIXct to store the time. I wanted to make a quasi time line using these time. I utilized the segments function to represent these times. However the segments rounds off at the ends and does not have the crisp look I need for my purposes.
2009 Jun 06
1
stars (as fourfold plots) in plot (symbols don't work)
Hi! I have a dataset with three columns -the first two refer to x and y coordinates, the last one are odds ratios. I'd like to plot the data with x and y coordinates and the odds ratio shown as a fourfold plot, which I prefer to do using the stars function. Unfortunately the stars option in symbols is not as cool as the stars function on its own, and now i can't figure out how to do it!
2012 Sep 23
1
Background color in a grid plot seems to interfere with plot()
Hi, Why does the upper left panel (in the plot below) not have a gray background? Cheers, Marius require(grid) require(gridBase) pdf(file="Rplot.pdf", width=8, height=8, onefile=FALSE) ## set up the grid layout gl <- grid.layout(5, 5, widths=unit(c(1.8, 8, 0.8, 8, 0.8), "cm"), heights=unit(c(0.8, 8, 0.8, 8, 1.5), "cm")) if(FALSE) grid.show.layout(gl)
2010 May 26
1
persp(); help with 'tck' option
Hi All, I'm using 'tck' option to *reduce* the length of tick marks but it is not working, can anyone please tell me where I'm going wrong... require(graphics) require(grDevices) x <- seq(-10, 10, length= 30) y <- x f <- function(x,y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r } z <- outer(x, y, f) z[is.na(z)] <- 1 # 'bg' works but 'tck' is not showing