Displaying 20 results from an estimated 1000 matches similar to: "geom_errorbar with ggplot2"
2007 Dec 11
2
ggplot - Setting the y-scale in a bar plot
Dear All (probably Hadley),
I am now trying to customise some plots using a bar geom.
I do not want to use the default binning statistic, but rather
calculate the bar heigths separately. I do manage this, but for
comparison purposes I would like to have a set of plots all with the
same y-axis height. But I do not seem to find out how to fix the
scale of the y-axis in this case.
Any tips?
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 Nov 01
1
ggplot2 - expand range?
Dear UserRs,
I am trying to use systematically ggplot2 for most of my plots, but I
am fighting some lack of documentation, which I try to overcome.
I want to build a scatterplot where the axes cross exactly at (0,0).
I tried using scale_y_continuous(limits=c(0,10)), but I always get an
extra space at the bottom of the axes. The code I used is below.
> plotdata<-data.frame(x=1:10,
2007 Oct 31
1
reversing the scale on ggplot
Dear All,
I am trying to build a simple ggplot, but where the scale is
reversed, i.e. the largest numbers are on the bottom.
An example of the code I am using is
> plotdata<-data.frame(x=1:10, y=runif(10))
> plot<-ggplot()
> plot<-plot+layer(data=plotdata, mapping=aes_string(x='x',y='y'),
geom='point', stat='identity', size=4)
>
2012 Sep 16
1
How to plot two lines, and only one line with errorbar by qqplots of R
Here is my code, which plots three lines with errorbar. How could I add an
extra line without errorbar to the plot? Thank you very much.
beta.data <- data.frame (
method = rep(c("Wrong", "Correct", "Full Bayes"), each = T_obs),
mean.beta = c(mean.beta1, mean.beta2, mean.beta3),
t = rep(points, 3),
std.beta = c(std.beta1, std.beta2, std.beta3)
)
limits =
2008 Mar 23
2
ggplot2 - legend for fill coulours
Dear All,
I am trying to build a stacked bar plot, where I define the colours to use.
I have asked this before, and I was using a solution in
http://thread.gmane.org/gmane.comp.lang.r.general/100649/focus=100673
(thanks, Thierry).
However, it looks this works only when the data are in the sequence
of the levels in the factor defining the fill colours. When the
sequence is different, the
2007 Dec 17
1
ggplot-How to define fill colours?
Dear R's (most likely Hadley),
I want to build a stacked bar plot where I would like to define which
colours will be used for each of the groups. However, I do not seem
to find a way to do this, even if I've been looking over many places.
I have tried several variations, and my final try was this code, but
I still do not manage to get the colours as I pre-define. Any hints
about how
2008 Apr 12
1
ggplot2 - plot with only legend?
I just found out that this message got scrambled with other threads,
so I trying to re-send...
Dear R'ers,
I am trying to build a composite plot (with several plots in one
figure). I have tried, but I cannot use facetting, as I need to
customize each plot using grid.
Since all the plots are the same (with different data, but same
layout and categories), I would like to have only one legend,
2007 Dec 18
1
ggplot2 - getting at the grobs
Dear All,
I continue trying to get several of my plotting functions to use
ggplot, because I really do like the concept of the graphical
objects, and working with them in the abstract.
I am now trying to access the grobs to manipulate using grid.
However, until now all I managed was to get the plot as a gTree
object, and manipulate it as a gTree from there. The problem is that
then it is no
2008 Jun 16
1
ggplot2: How to remove legend component for geom_errorbar() ?
Dear list (probably Hadley),
I'm trying to do a plot like the following, composed of bars and error
bars:
df <- data.frame(factor1=gl(2,5), factor2=gl(5,1), y=rnorm(10),
err=0.1)
ggplot(df, aes(x=factor1, y=y, fill=factor2)) +
geom_bar(position="dodge", stat="identity") +
geom_errorbar(aes(min=y-err, max=y+err), position="dodge",
width=0.1)
The
2008 Nov 25
1
Efficient passing through big data.frame and modifying select
> -----Original Message-----
> From: William Dunlap
> Sent: Tuesday, November 25, 2008 9:16 AM
> To: 'johannes_graumann at web.de'
> Subject: Re: [R] Efficient passing through big data.frame and
> modifying select fields
>
> > Johannes Graumann johannes_graumann at web.de
> > Tue Nov 25 15:16:01 CET 2008
> >
> > Hi all,
> >
> >
2008 Dec 23
1
quotation problem/dataframe names as function input argument.
Dear R friends:
Can someone help me with the following problem? Many thanks in advance.
# Problem Description:
# I want to write functions which take a (character) vector of dataframe
names as input argument.
# For example, I want to extract the number of observations from a number of
dataframes.
# I tried the following:
nobs.fun <- function (dframe.vec)
{
nobs.vec <-
2012 Mar 30
1
How to use access results of gregexpr in data frames
Hello,
I'm trying to figure out how to find the index of the second occurrence of "/" in a string (which happens to represent a date) within a data frame column.
I've used the following code successfully to find the first instance of "/".
dframe <- data.frame(date=c("5/14/2011", "4/7/2011"))
dframe$x1 <- regexpr("/", dframe[, 1])
2011 Jun 09
3
How to subset based on column name that is a number ?
Hi,
I have a data frame with column names "1", "2", "3", ... and I'd like to extract
a subset based on the values in the first column. None of the methods I tried
worked (below).
x <- subset(dframe, 1 = = "My Text")
x <- subset(dframe, "1" = = "My Text")
x <- subset(dframe, names(dframe)[1] = = "My Text")
Q
2005 Nov 09
2
error in NORM lib
Dear alltogether,
I experience very strange behavior of imputation of NA's with the NORM
library. I use R 2.2.0, win32.
The code is below and the same dataset was also tried with MICE and
aregImpute() from HMISC _without_ any problem.
The problem is as follows:
(1) using the whole dataset results in very strange imputations - values
far beyond the maximum of the respective column, >
2010 Oct 13
4
Change global env variables from within a function
Hi,
I've looked all over for a solution to this, but haven't had much look
in specifying what I want to do with appropriate search terms. Thus I'm
turning to R-help.
In the process of trying to write a simple function to rename individual
column names in a data frame, I ran into the following problem: When I
rename the columns within my function, I can't seem to get it to
2009 Oct 02
1
ggplot2: proper use of facet_grid inside a function
Hello Again R Folk:
I have found items about this in the archives, but I?m still not getting
it right. I want to use ggplot2 with facet_grid inside a function with
user specified variables, for instance:
p <- ggplot(data, aes_string(x = fac1, y = res)) + facet_grid(. ~
fac2)
Where data, fac1, fac2 and res are arguments to the function. I have
tried
p <- ggplot(data,
2006 Jan 20
3
Selecting data frame components by name - do you know a shorter way?
Hi! I suspect there must be an easy way to access components of a data frame by name, i.e. the input should look like "name1 name2 name3 ..." and the output be a data frame of those components with the corresponding names. I ´ve been trying for hours, but only found the long way to do it (which is not feasible, since I have lots of components to select):
2013 Apr 30
1
Stacked geom_bar with aggregated SE -ggplot2
Hi there,?
I've been battling with an extension of this in my own data: getting
appropriate error bars once data is stacked in a bar graph.?
(original question:
http://r.789695.n4.nabble.com/ggplot2-se-variable-in-geom-errorbar-s-limits-
td3311176.html). It wouldn't let me reply to that thread.
A modification of the earlier answer:?
data(diamonds)?
?diamonds_df <- ddply(diamonds,
2011 Jul 08
1
Referencing a vector of data labels in ggplot function
Hi,
I really feel I've looked everywhere, although I know this can't be a hard
problem. I'd like to be able to call the graph below as a function, but I
can't get the function to recognize variables beyond 'dframe'. I've read
through many papers on writing functions in R, but I can't get this to work.
data <- data.frame('date' = as.Date(rep(c(15101,