Displaying 20 results from an estimated 3000 matches similar to: "Another question on gplot"
2009 Jul 18
7
Question on qplot
Hi, suppose I have following codes :
library(zoo); library(ggplot2)
dat <- matrix(rnorm(500*2), 500); dat <- zooreg(dat, start =
as.Date("01/01/01", "%m/%d/%y"), frequency=1); plot(dat)
head(dat); month.no <- format(index(dat), "%m"); dat1 <-
cbind(coredata(dat), as.numeric(month.no))
x <- dat1[,1]; y <- dat1[,2]; z <- dat1[,3]
Now I draw a
2010 Jan 18
2
ggplot2 histogramm
Hi,
i get no success change the title of the "fill" (colour) legend and the
defintion of "levels". Have anybody a hint how i can do this.
df <-
data.frame(variable=sample(c("A","B","C"),1000,replace=T,prob=c(0.22,0.28,0.5)),group=gl(2,500))
p <- ggplot(df, aes(x = variable))
p + geom_histogram(aes(y= ..count.. /
2010 May 10
1
ggplot: Trouble with xlim() and discrete scales
I'm learning ggplot and am a little confused. Sometimes discrete scales work
like I'd expect, and sometimes they don't. For example...
This works exactly like one would expect:
df<-data.frame(names=c("Bob","Mary","Joe","Bob","Bob"))
ggplot(df,aes(names))+geom_histogram()
But this yields an error:
2024 Jun 26
2
Ayuda para hacer una lista
Hola
Soy Leticia, quería hacer una consulta al grupo a ver si me podéis ayudar.
Tengo unos datos de proteínas, el data frame es: 5 columnas iniciales que
tienen información sobre las proteínas y después las columnas con las
intensidades, de las cuales no se cuantas condiciones tienen ni cuántas
réplicas por condición.
Estoy intentando hacer un cálculo del coeficiente de variación por grupo y
2009 Jul 28
2
Density plot in ggplot2
Hi all, I was trying to draw a stacked density plot like that :
library(ggplot2); library(plyr)
dat <- cbind(rnorm(300), rep(c(1,2), each=150))
ggplot() + geom_density(aes(x=dat[,1], fill=factor(dat[,2]),
position="stack")) +
xlab("") + ylab("") +
scale_colour_manual(name = "Pallet", labels = c("X", "Y"))
Here
2004 Nov 21
3
Help with ooplot(gplots) and error bars
Dear All
I am trying to graph a proportion and CI95% by a factor with ooplot (any
other better solution ?)
It works well until I try to add the confidence interval.
this is the error message and and a description of the data:
> dat1
PointEst
TT1 1 3.6
TT2 2 5.0
TT3 3 5.8
TT4 4 11.5
TT5 5 7.5
TT5 6 8.7
TT7 7 17.4
> dat2
2011 Jun 07
1
ggplot2 Histogram with density curve
I am learning ggplot2 commands and I have figured out how to create
histograms and density curves but I am not sure how to add a density curve
on top of a histogram.
Here are the two graphs that I created.
## Histogram
t<-rnorm(500)
w<-qplot(t, main="Normal Random Sample", fill=I("blue"), colour=I("black"),
geom="histogram")
w
##Density Curve
2008 Jun 13
1
overlaid transparent histograms
Hello all--
I'm attempting to produce overlaid histograms with partially transparent
columns. Whether this display will end up being useful, I can't say.
But I do want to get it right.
I've already got one solution (shown below), but I tried some other
versions and had questions about my results. (Note: I'm using a quartz
device, so transparency shows up correctly. You might
2024 Jun 27
2
Ayuda para hacer una lista
Muchas fracias por la rapida contastacion Javier.
Si, ya me he dado cuenta que a veces es mas limpiar y formatear que
calcular.
Lo que yo necesito hacer no es crear un data.frame, es crear una lista por
cada grupo/condicion de muestras. Y queria hacerlo en un for loop, para que
no tuviese que indicar cuantas listas necesito si no que cogiese esa
informacion del usuario (y)
Creo que no me
2024 Jun 26
1
Ayuda para hacer una lista
Hola Leticia
Acomodar datos para analizar suele llevar más trabajo que el análisis.
Yo prefiero en un data.frame colocar todos los datos, porque siempre es más fácil filtrar que agregar. Cuándo tengo el data.frame con todo, realizo un plot (datos), y muchas veces en la gráfica veo cosas que me llaman la atención, de esta forma busco algo de antemano no sospechaba.
No es necesario que conozcas
2017 Dec 13
1
overlay two histograms ggplot
Hi all,
How can I overlay these two histograms?
ggplot(gg, aes(gg$Alz, fill = gg$veg)) + geom_histogram(alpha = 0.2)
ggplot(tt, aes(tt$Cont, fill = tt$veg)) + geom_histogram(alpha = 0.2)
thanks for any help!
Elahe
2023 Jan 12
1
Reg: ggplot error
Hallo
I am not familiar with any of packages you use (except of MASS and ggplot2) and the code is too complicated without any hint where the error could come from and what is the message you get. I wonder if anybody would like to go through your whole code.
1. data seems to be read correctly
ICUData <- read.csv(file = "ICUData.csv", stringsAsFactors = TRUE)
ICUData.neuro <-
2009 Jul 21
1
geom_histogram help
Hi,
I have a histogram.But I need seperate colours for fixed range of values.for
eg. between 2-3 on the x axis a colour.3-4 another colour etc. and the
legend has to say what each colour is.How can this be done in
geom_histogram?
--
Rajesh.J
[[alternative HTML version deleted]]
2009 Aug 19
2
ggplot2 legend problem
I'm trying to overlay two histograms using transparency to enable viewing of
multiple distributions on a single scale. So far ggplot2 seems to do what I
want. However I'm having a problem generating the legend coloring
appropriate to each distribution in the plot.
Here is a test case to show my best (failed) effort so far:
library(ggplot2)
x <- data.frame(X=rnorm(1000, mean=0))
y
2011 Mar 29
1
ggplot2: scale_y_log10() with geom_histogram
Dear ggplot2 users,
is there an easy/elegant way to suppress zero count bars in histograms with
logarithmic y axis ?
One (made up) example would be
qplot(exp(rnorm(1000))) + geom_histogram(colour = "cornsilk", fill =
"darkblue") + scale_x_sqrt() + scale_y_log10()
Thanks!
Markus
[[alternative HTML version deleted]]
2018 May 11
0
add one variable to a data frame
Sarah's solutions are good, and here's another, even more basic:
tmp1 <- unique(dat1$B)
tmp2 <- seq_along(tmp1)
dat1$C <- tmp2[ match( dat1$B, tmp1) ]
> dat1
N B C
1 1 29_log 1
2 2 29_log 1
3 3 29_log 1
4 4 27_cat 2
5 5 27_cat 2
6 6 1_log 3
7 7 1_log 3
8 8 1_log 3
9 9 1_log 3
10 10 1_log 3
11 11 3_cat 4
12 12 3_cat 4
As a single line
2010 Mar 30
2
Need help to split a given matrix is a "sequential" way
I need to split a given matrix in a sequential order. Let my matrix is :
> dat <- cbind(sample(c(100,200), 10, T), sample(c(50,100, 150, 180), 10,
> T), sample(seq(20, 200, by=20), 10, T)); dat
[,1] [,2] [,3]
[1,] 200 100 80
[2,] 100 180 80
[3,] 200 150 180
[4,] 200 50 140
[5,] 100 150 60
[6,] 100 50 60
[7,] 100 100 100
[8,] 200 150 100
[9,]
2009 Oct 10
1
Resultados distintos
Buenas tardes a todos,
tengo un problema con R: ejecuto el mismo script en el ordenador del trabajo y en mi portátil con los mismos
datos y obtengo resultados diferentes (siendo los correctos, los obtenidos en el trabajo):
rm(list=ls())
directorio<-"C:\\Documents and Settings\\BDs\\"
library(RODBC)
library(car)
library(gdata)
### DATOS A ###
2018 May 11
0
add one variable to a data frame
Hi,
Here's one way to approach it, using the coercion of factor to numeric.
Note that I changed your data.frame() statement to avoid coercing
strings to factors, just to make it simpler to set the levels.
dat1 <-data.frame(N=seq(1, 12,1), B=c("29_log","29_log", "29_log",
"27_cat", "27_cat", "1_log", "1_log",
2018 May 11
3
add one variable to a data frame
Hi Sarah,
Thank you so much!! I got your good ideas.
Ding
-----Original Message-----
From: Sarah Goslee [mailto:sarah.goslee at gmail.com]
Sent: Friday, May 11, 2018 11:40 AM
To: Ding, Yuan Chun
Cc: r-help mailing list
Subject: Re: [R] add one variable to a data frame
[Attention: This email came from an external source. Do not open attachments or click on links from unknown senders or