Displaying 20 results from an estimated 8000 matches similar to: "Coord_equal in ggplot2"
2008 Jan 11
1
ggplot2, coord_equal and aspect ratio
Hi everyone, Hi Hadley,
I am a heavy user of coord_equal() in ggplot2 since most of my data is
spatial, on x,y coordinates. Everything works. However by enforcing an
aspect ratio of 1 for the plotting region, coord_equal() usually
wastes a lot of space if the region of interest is not a perfect square.
For example:
x=runif(10)
a=data.frame(x=x*3,y=x)
ggplot(data=a, aes(x=x,y=y)) +
2013 Jan 28
1
incorrect import?
Dear all,
I'm not getting what I'm doing wrong. The line below from my read.fsa.bin function throws an error when just loading my AFLP package and disappears when I load the zoo package as well.
#the line that throws the error
Index <- which(Peak == rollmax(Peak, k = 1 + 2 * floor((min(diff(SizeStandard)) * Fs - 1) / 2), fill = -Inf))
#the error
Error in UseMethod("rollmax")
2007 Jul 25
1
Ggplot2 equivalent of axis and problem with log scale
Dear useRs,
Recently I've discorved ggplot2 and I must say that I really like it,
although the documentation still is a working in progress.
My first question: How can I change the position of the labels and the
text of the labels? With a basic plot I would use axis(2, at =
position.of.the.ticks, labels = text.at.the.ticks). Could someone
provide me with an example of how to do this with
2009 Jul 22
1
Link to documentation in another package
Dear all,
One of the functions that I wrote (ggsave.latex) extents the
functionality of a function (ggsave) in another package (ggplot2).
Instead of copying all the information I would like to create a link in
the helpfile of ggsave.latex to the helpfile of ggsave. I tried
\code{\link{ggsave}} and \code{\link{ggplot2::ggsave}}, but neither
worked. Both cases gave a 'missing link' warning.
2012 Nov 05
2
averaging a list of matrices element wise
Dear all,
I have a list of n matrices which all have the same dimension (r x s). What would be a fast/elegant way to calculate the element wise average? So result[1, 1] <- mean(c(raw[[1]][1, 1] , raw[[2]][1, 1], raw[[...]][1, 1], raw[[n]][1, 1]))
Here is my attempt.
#create a dummy dataset
n <- 3
r <- 5
s <- 6
raw <- lapply(seq_len(n), function(i){
matrix(rnorm(r * s), ncol =
2009 Apr 23
1
ggplot2/aesthetic plotting advice
Consider the following situation:
we have quantified algal concentrations for
a variety of species using many samples at each
of three years. It seems to make sense to generate
a line plot (matplot-like), with each species plotted
as a separate line, with the points connected to emphasize
the temporal pattern.
The problem: lots of overlapping error bars.
The question: from both a
2009 Mar 11
1
Ggplot2: saving a grid with multiple plots
Hi all,
I have managed to create a figure on the screen with multiple plots in
it. Something like the example below. When I save that with ggsave(),
only the last plot gets saved (pPath in the example) instead of the
entire figure. Any suggestions how I can save this kind of figures
automated?
Thanks,
Thierry
library(ggplot2)
pPoint <- qplot(unemploy/pop, psavert, data=economics)
pPath
2012 Apr 25
1
Strange bug in my package
Dear all,
I get a bug in the examples of my AFLP package on R-forge (https://r-forge.r-project.org/R/?group_id=1027) but only on the Linux version. The windows version compiles. The Mac version skips the examples and compiles. The strange thing is that the packages compiles on my Ubuntu 10.10 machine with R 2.15.0. Therefore I can't reproduce the error.
I have traced the problem at
2013 Apr 04
1
Non-vignette sweave file in package
Dear all,
I'm documenting an elaborate analysis as a private package. The package writes all required output to a database. I use a Sweave file to transform all the results from the database into a report.
Now I would like to add this Sweave to my package. I'm a bit puzzled on how to do that. It is not a vignette: the data is not available when the package is build and I need to
2012 Dec 14
1
Problem loading .Rdata file
Dear all,
I'm having troubles migrating a large matrix from one system to another.
#system 1: Ubuntu 12.04, 64-bit, running R 2.15.2
# do some simulations
# save the simulations
> save(Output, file = "Simulations.Rdata")
#Output is a numeric matrix with 6 columns and about 2M rows.
Use ftp to transfer the Simulations.Rdata file to system 2
#system2: Windows XP, 32-bit running
2008 Dec 16
1
Prediction intervals for zero inflated Poisson regression
Dear all,
I'm using zeroinfl() from the pscl-package for zero inflated Poisson
regression. I would like to calculate (aproximate) prediction intervals
for the fitted values. The package itself does not provide them. Can
this be calculated analyticaly? Or do I have to use bootstrap?
What I tried until now is to use bootstrap to estimate these intervals.
Any comments on the code are welcome.
2009 Apr 17
2
Generate bivariate binomial data
Dear all,
Could someone point me to a function or algorithm to generate random
bivariate binomial data?
Some details about what I'm trying to do. I have a dataset of trees who
were categorised as not damaged or damaged. Each tree is measured twice
(once in two consecutive years). The trees can recover from the damage
but the data is clearly correlated. As a (un)damaged tree is more likely
2014 Apr 03
1
summary of lme4.0 model in package
Dear all,
My package has Depends: lme4.0 in the DESCRIPTION. I need to extract the fixed effect of a model and their standard errors. I use coef(summary(model)) inside a function to do that. Model is the output of a call to glmer() from the lme4.0 package.
coef(summary(model)) throws an error: $ operator is invalid for atomic vectors
I have tracked it down to a problem with summary(model)
2009 Apr 22
1
Gee with nested desgin
Dear all,
Is it possible to incorporate a nested design in GEE? I have
measurements on trees that where measured in two years. The trees are
nested in plots. Each plot contains 24 trees. The number of plots is 72.
Hence we would expect 2 * 24 * 72 = 3456 data points. A few are missing,
so we end up wih 3431 data points.
This is what I have tried until now.
#assuming independence between trees
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 Dec 03
3
ggplot2: Choosing colours
Dear useRs,
I'm trying to specify the colour of a factor with ggplot2. The example
below gets me close to what I want, but it's missing a legend.
Any ideas?
Thanks,
Thierry
library(ggplot2)
dataset <- data.frame(x = rnorm(40), y = runif(40), z = gl(4, 10, labels
= LETTERS[1:4]))
ggplot(data = dataset, aes(x = x, y = y, group = z)) + geom_point(colour
= c("red",
2013 Jul 30
1
Error from R CMD check
Dear all,
I'm puzzled by the error I get from R CMD check one of my packages. I'm running R CMD check with the --as-cran flag and it get the error both from running it from the command line as from within Rstudio. On the same machine R CMD check on my GRTS package (https://r-forge.r-project.org/R/?group_id=1027) works fine.
Any suggestions on how to fix this? I can send the source code
2012 Nov 26
2
puzzling RODBC error
Dear all,
I'm trying to connect to an MSAccess database (ArcGIS personal geodatabase). I keep getting an error about the channel when using sqlQuery(). However, sqlTables() does not complain about the channel and lists all tables in the database. If I try sqlFetch(), then R crashes.
I'm happy to hear suggestions on how to solve this.
Best regards,
Thierry
> MDB <-
2010 Feb 26
1
ggplot2 : bug in coord_equal() ?
Hello,
I think there is a bug in coord_equal when x s a factor :
ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar()
ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar() + coord_equal(1/2)
David
2013 Sep 30
1
predictions in nlme without fixed covariantes
Dear all,
predict.lme() throws an error when the fixed part consists of only an intercept and using newdata. See the reproducible example below. I've tracked the error down to asOneFormula() which returns in this case NULL instead of a formula. Changing NULL instead of ~1 in that function (see below) solves the problem in the case of an intercept only model (m1). It does not solve the problem