Displaying 20 results from an estimated 6000 matches similar to: "Histogram: plot by group"
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 Jul 08
4
Histogram with colors according to factor
Given a data frame with a continuous variable and a factor. I would like to
generate a histogram of the continuous variable, where each bar is filled
with different colors according to the percentage of factor values falling
into this region of the continuous variable.
I looked into packages like 'lattice' and 'ggplot2'. Searching R-help
revealed that 'histogram' is
2011 Jul 25
1
two sample histogram
dear all,
i am anewcomer. i have a set of paired data, the values are great different from each other. i want to show them in histogram.
first, how to draw each bar for corresponding paired data side by side;
second, how to set the scale of y axis? one is up to 100-fold to the other. ifdoubleslash is used to omit some coordinates, the histogram will looks better.
is there anyone that can help
2012 Aug 06
4
Overlay Histogram
Dear all,
For two sets of random variables, say, x <- rnorm(1000, 10, 10) and y
<- rnorm(1000. 3, 20).
Is there any way to overlay the histograms (and density curves) of x and y
on the plot of y vs. x?
The histogram of x is on the x axis and that of y is on the y axis.
The density curve here is to approximate the shape of the distribution
and does not have to have area 1.
Thank you
2009 Sep 02
2
Howto fit normal curve into histogram using GGPLOT2
Currently, I am doing it this way.
x <- mtcars$mpg
h<-hist(x, breaks=10, col="red", xlab="Miles Per Gallon",
main="Histogram with Normal Curve")
xfit<-seq(min(x),max(x),length=40)
yfit<-dnorm(xfit,mean=mean(x),sd=sd(x))
yfit <- yfit*diff(h$mids[1:2])*length(x)
lines(xfit, yfit, col="blue", lwd=2)
But since, ggplot2 has more appealing
2009 Mar 25
5
histogram plots with many different samples
Dear R users,
I would like to draw some histograms as seen in the page whose address I
wrote below. I searched through the web a lot and I found a page which
describes how I can do it for older versions of R. For newer versions they
recommend to install the package R.basics in R.clusters but this does not
exist. The address of the web page is
http://www1.maths.lth.se/help/R/plot.histogram/
2013 Jul 25
1
GGplot 2 – cannot get histogram and box plot axis to match.
Problem:
I am trying to get the histogram and box plot x axis to match. I?ve tried using the expand_limits function to make the axis match but that didn?t make the axis match. The histogram?s axis are still consistently larger than the ones for the box plot (though the function did help). Does anyone have a suggestion as to what I should do instead?
Background:
I am building a Shiny app that
2008 Oct 08
1
Observed responses in 'augPred' data frame - Wrong order ?
Dea-R community.
I'd like to draw your attention to an issue I have recently
encountered while doing my current data analysis.
I've got an unexpected (to me) result from the command:
> augPred(lmList(my.object)),
'my.object' being a grouped data frame of class:
> class(my.object)
[1] "nfnGroupedData" "nfGroupedData" "groupedData"
2011 Jul 25
4
ggplot question: changing the label for the Y axis on a histogram
Some help with how to re-label the vertical axis in a histogram would be appreciated.
qplot(off.sc,weight=rel.freq,binwidth=.29,main="test Figure"+ylab("New from inside"))+ylab("New from outside")+
xlab("off.sc\nAggregated frequency plots for 17 equal intervals.")
The code
2009 Oct 04
2
Row to Column help
Dear R Community,
I am attempting to transpose a dataset from rows to columns but am stuck. I
have tried using reshape() with little luck, possibly due to the categorical
nature of the data. For example:
id<-c(1,2,2,3,3,3)
author<-c("j","k","k","l","l","l")
2009 Jan 03
2
R Stacked Histogram
I've seen this asked, but never fully answered.
Is it possible to plot stacked histograms in R?
I have four data sets that I would like to show combined vertically in histogram format.
Is this possible?
Thank you for any feedback you can provide.
P.S. I know I can show the four sets side by side, but I want to combine them, but still uniquely identify each. Thanks again.
2009 Aug 19
1
histogram scaling
Hi,
I'm drawing two histograms in the same plot.However, my point of comparison
is the difference in their x coordinates.But my problem is one histogram is
much taller than the other.How can I get them both to the same height?
--
Rajesh.J
[[alternative HTML version deleted]]
2011 Mar 07
1
help needed with histogram plotting
Dear all,
I am trying to plot 3 histograms on the same graph using the following
command.
hist(x,xlim=c(0,100))
hist(y,add=TRUE)
hist(z,add=TRUE)
The xlim of y is c(20,21) and that of z is c(99,99.5) , whereas the variable
x has xlim at c(0.5,2). Apparently, the graph end of displaying a line only,
corresponding to each histogram due to the wide range of the xlim and
tightness of the
2011 Jun 07
1
ggplot 2: Histogram with bell curve?
I am learning ggplot2 commands specifically qplot for the time being and I
have figured out how to create histograms and normal density curves but I am
not sure how to add a normal bell curve or other dist. as well 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"),
2010 Nov 30
2
ggplot2 histograms
Hi
With ggplot2 I can very easily create beautiful histograms but I would like to put two histograms on the same plot. The histograms may be over-lapping.
When they are overlapping the bars are shown on top of each other (so that the overall height is the sum of the two). Is there any way to get them to display overlapping (with smaller value in front, larger value behind) so that the overall
2009 Nov 30
5
Histogram and Density on the the same graph
Dear all,
I cannot find a function which would allow drawing hist and density on the
same graph.
x <- seq(1,40,1)
y <- 2*x+1+5*rnorm(length(x))
hist(y,freq = FALSE)
plot(density(y))
thanks a lot for the help
[[alternative HTML version deleted]]
2017 Nov 07
1
fill histogram in ggplot
Hi all,
I have the following data and I have a histogram for mms like
ggplot(hist,aes(x=hist$mms))+ geom_histogram(binwidth=1,fill="white",color="black")and then I want to fill the color of histogram by probable=1 and probable=0, could anyone help me in this?
My data:
structure(list(probable = c(1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 1L,
0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 1L,
2018 Feb 23
2
Stale mailbox lock file
<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2">
<div>Thanks Aki,</div><div><br></div><div>do you know if this list is read by dovecot developers team too? Could you point me to the right list otherwise?</div>
<div><br><br>Raffaele
2018 Feb 23
1
Stale mailbox lock file
<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2">
<div style="font-family: Verdana, Arial, Helvetica, sans-serif;">So you don't know when this piece of code is executed:</div>
<div style="font-family: Verdana, Arial, Helvetica, sans-serif;"><br></div>
<div style=""><pre
2009 Jul 20
3
Histograms on a log scale
Dear All,
I would like to be able to plot histograms/densities on a semi-log or
log-log scale.
I found several suggestions online
http://tolstoy.newcastle.edu.au/R/help/05/09/12044.html
https://stat.ethz.ch/pipermail/r-help/2002-June/022295.html
http://www.harding.edu/fmccown/R/#histograms
Now, consider the code snippet taken from
http://www.harding.edu/fmccown/R/#histograms
# Get a random