Displaying 20 results from an estimated 3000 matches similar to: "ggplot2 customizing"
2007 Mar 02
3
from function to its name?
Hi,
I can get from a string to a function with this name:
>f1 <- function(x){ mean(x) }
>do.call("f1",list{1:4})
>get("f1")
etc...
But how do I get from a function to its name?
>funcVec <- c(f1,median)
>funcVec
[[1]]
function(x){ mean(x) }
> str(funcVec)
List of 2
$ :function (x)
..- attr(*, "source")= chr "function(x){ mean(x)
2005 Aug 29
2
reexpand a matrix after subsetting
Hi,
suppose I have a matrix (or dataframe)
as a result from subsetting.
mat <- matrix(1:20,ncol=2)
mat[c(3,6,9),] <- NA
cc <- complete.cases(mat)
sub <- mat[cc,,drop=FALSE]
sub <- sub * 2
#some caluculations with sub.
now I would like to expand sub somehow
so row 3,6, and 9 would be filled with
NAs but the rest should be in place again.
Is there a simple function for this?
2006 Dec 07
1
templating library for R
Hi,
does anybody know of a templating library for R,
like velocity or freemarker?
It doesn't have to be very fancy just a bit
better than sub in replacing tags in a text (not
necessarily html) file.
thank you very much for your answer.
Ido
2007 Aug 09
1
depreciation of $ for atomic vectors
Dear All,
I would like to know why $ was deprecated for atomic vectors and
what I can use instead.
I got used to the following idiom for working with
data frames:
df <- data.frame(start=1:5,end=10:6)
apply(df,1,function(row){ return(row$start + row$end) })
I have a data.frame with named columns and
use each row to do something. I would like the
named index ($) because the column position
in
2008 Apr 04
0
ggplot2 - version 0.6
ggplot2 ------------------------------------------------------------
ggplot2 is a plotting system for R, based on the grammar of graphics,
which tries to take the good parts of base and lattice graphics and
avoid bad parts. It takes care of many of the fiddly details
that make plotting a hassle (like drawing legends) as well as
providing a powerful model of graphics that makes it easy to produce
2008 Apr 04
0
ggplot2 - version 0.6
ggplot2 ------------------------------------------------------------
ggplot2 is a plotting system for R, based on the grammar of graphics,
which tries to take the good parts of base and lattice graphics and
avoid bad parts. It takes care of many of the fiddly details
that make plotting a hassle (like drawing legends) as well as
providing a powerful model of graphics that makes it easy to produce
2008 Nov 03
1
dev2bitmap: extra missing
Hi,
I don't know if I am the first one to report the problem:
in 2.8.0 dev2bitmap gained aa support, but "extra" is null
if neither taa nor naa is specified.
> dev2bitmap("plot.pdf",type="pdfwrite")
Error in paste(shQuote(gsexe), " -dNOPAUSE -dBATCH -q -sDEVICE=", type, :
object "extra" not found
>
2005 Dec 13
1
correct C function usage
Hello,
I am not sure if I am interfacing with C correctly and _safely_
or if there is a better way esp. with regards to terminating
the "returned" array.
I am trying to fill an int array with values whose actual size
is determined in the C function and is always maximally as large
as length(values).
I also don't understand the purpose of $ab in the example:
conv <- function(a,
2008 Jun 30
1
2.7.0 breaks read.table
Hi,
yes a bold statement, but I get different behaviour
from 2.6.2 and 2.7.0 in read.table, and I don't find
any documentation in http://cran.r-project.org/src/base/NEWS.
A file like (space delimited):
foo + .
bar - .
2.7.0:
> tab <- read.table("test.txt",as.is=TRUE)
> tab
V1 V2 V3
1 foom 0 0
2 bar 0 0
while until now and on 2.6.2
> tab <-
2008 Jan 09
1
Rscript on OSX
Hi,
I directed somebody to install R (2.6.1) on his OSX computer,
following instructions from http://cran.r-project.org/bin/macosx.
She can run R from the console.
But plot(1:10) doesn't produce any output or open a window (as I am
used to from linux).
More importantly:
Rscript is not in the path (minor problem ln -s is hopefully doable). I tried
to put a hardcoded path to Rscript into the
2010 Mar 31
1
ggplot2: Adding points to a density plot
Hi,
Consider something like
> library(ggplot2)
> movies$decade <- round_any(movies$year, 10)
> m <- qplot(rating,data=movies,colour=factor(decade),geom="density")
> m
(modified from "?stat_density").
I'd like to add on the line y=0 a dot for the median of each "decade"
category (using the same colour coding as the "fill"). I'm
2009 Mar 20
1
ggplot2: specifying legend titles
I am trying to specify a legend title to be other than the variable
name, but I find that the legend splits because scale_shape() takes
effect but scale_colour() does not. Can someone spot my error?
Here's some toy code that produces the problem on my system (R2.8.1,
windows, today's CRAN package updates):
library(ggplot2)
a <- sample(letters[1:5],100,replace=T)
b <-
2009 Mar 25
2
[ggplot2] Densityplot, grouping and NAs
Dear all,
I do not fully understand how ggplot2 handles NAs. See the following
example:
library(ggplot2)
x <- rnorm(150)
g <- as.factor(c(rep(c(0,1,NA),50)))
mydf <- data.frame(x,g)
m <- ggplot(aes(x = x, group = g, color = g), data = mydf)
m + geom_density()
How do I get rid of the NAs (i.e. the blue colored curve)?
I thought
## m <- ggplot(aes(x = x, group = g, color = g,
2013 Feb 25
1
ggplot2 Increase font size
Dear all,
I am using the code as below
tdm <- melt(matrixToPlot)
p<- ggplot(tdm, aes(x = Var2, y = Var1, fill = factor(value))) +
labs(x = "Mz", y = "T", fill = "D") +
geom_raster(alpha=1) +
scale_fill_discrete(h.start=1) +
scale_x_continuous(expand = c(0, 0)) +
2009 Jan 30
1
Using ggplot2 I need to move the location of legend to on the plot
Thanks again for the hints about adding the vertical line to the hist plot and in ggplot. That worked great.
Based on that advice I've been flipping through the ggplot2 doc and ggplot-static\index.html webpage more looking for the answer to the next question.
Unfortunately, I haven't stumbled on a description of how to move around the location of the legend.
Here is what I
2009 Jul 23
1
tweak a bit the legend wiht ggplot2
Hi all,
I've this ggplot2 graph
(http://www.4shared.com/file/120101043/f3e9350/isotherm.html).
I'd like to tweak the legend for the adsorbent part. I'd like to have full
square of the colors instead of the full circles.
I guess that I've to work on the scale_color_hue or fill somewhere but I
haven't found my way yet.
Here is my code to get the graph:
2013 Sep 26
1
Less than equal to symbol in ggplot2 legend text
Hello,
I am trying to add a less than equal to symbol in a ggplot2 legend text.
See sample code below. I have tried using the expression function and
\u2264. I also tried adding labels to legend.text under theme.
Neither of these 3 options work.
Please help,
Mahesh
++++++++++++++
Extra.column=ifelse(data[,covariate]>cutpoint,1,0)
Grp1 <- "\u2264 1.5"
Grp2 <-
2011 Aug 31
2
ggplot2 to create a "square" plot
Dear all,
I am using ggplot with geom_tile to print as an image a matrix I have. My matrix is a squared one of 512*512 cells.
The code that does that is written below
> print(v + geom_tile(aes(fill=dB))+ opts(axis.text.x=theme_text(size=20),axis.text.y=theme_text(size=20), axis.title.x=theme_text(size=25) , axis.title.y=theme_text(size=25), legend.title=theme_text(size=25,hjust=-0.4) ,
2008 Mar 25
2
ggplot2 - facetting
Dear All,
After having overcome the issue of legends (thanks, Thierry, once
more), I am trying to use facetting, but here also I can not find how
to do this. I do not want to use qplot, but rather the more flexible
options. However, it seems I am doing still something pretty stupid,
because I always get an error, even if it seems I am doing everything
like the examples.
My code is below.
2007 Sep 02
0
ggplot2 - version 0.5.5
ggplot2
===================================
ggplot2 is a plotting system for R, based on the grammar of graphics,
which tries to take the good parts of base and lattice graphics and
avoid bad parts. It takes care of many of the fiddly details
that make plotting a hassle (like drawing legends) as well as
providing a powerful model of graphics that makes it easy to produce
complex multi-layered