Displaying 20 results from an estimated 3000 matches similar to: "problem plotting with ggplot2"
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.. /
2007 Nov 08
1
ggplot2 facets as rows and columns
Does anyone (Hadley??) know if there's a straightforward
way in ggplot2 to get data divided by a single factor to
plot as a rectangular grid of subplots? So far I've only
been able to get such data plotted as a single row or
single column of skinny subplots. The code below gives
an example implemented with lattice, and my best
attempt in ggplot2
cheers
Ben Bolker
------------
g=
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
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]]
2009 Feb 02
1
Broke ggplot...
It appears I broke ggplot in my script, but that maybe it is because the caffeine has worn off or maybe it is late in the day. I thought I was beginning to understand ggplot, but I have encountered a silly little issue.
For some reason the following does not produce a histogram with fill due to the Person's characteristics:
(Note that VADeaths_flat_df$Data works fine...)
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:
2010 Jul 29
2
ggplot2 histograms... a subtle error found
Hello all,
I have a peculiar and particular bug that I stumbled across with
ggplot2. I cannot seem to replicate it with anything other than my specific
data set.
Here is the problem:
- when I try to plot a histogram, allowing for ggplot2 to decide the
binwidths itself, I get the following error:
- stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to
2010 Nov 09
1
ggplot2: facet_grid with different vertical lines on each facet
Hello,
I am plotting many histograms together using facet_grid in ggplot2. However,
I want to then add a vertical line to each histogram, or facet, each of
which vertical lines are at different x-values.
The following example adds all vertical lines to each facet:
ggplot(data,aes(values)) + geom_histogram() + facet_grid(.~variable) +
geom_vline(xintercept=c(5,10,15))
How can I add a vertical
2016 Jul 13
2
par() y ggplot2
Hola.
Tengo 4 gráficos:
a <- qqnorm(total$ImpTotal) #con lattice
y b, c y d son variaciones de este tipo?, creados con ggplot2:
?b <- g <- ggplot(data = total, aes(x=ImpTotal, fill=Convenio))
g + geom_histogram(binwidth = 90) ?
Los quiero representar de la forma:
par(mfrow=c(2,2))
a
b
c
d
Pero los que crea con ggplot2 aparecen en par(mfrow=c(1,1)), es decir:
ignora la instrucción.
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
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 Oct 12
2
Error: cannot allocate vector of size 1.2 Gb
Dear List,
today I turn to you with a next problem. I'm trying to compare species
richness between various datasets (locations) using species accumulation
curves (Chapter 4, page 54 in Tree diversity
analysis<http://www.worldagroforestry.org/treesandmarkets/tree_diversity_analysis.asp>by
Kindt & Coe). To accomplish this I'm using package
BiodiversityR. My data is comprised of
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 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 Jul 23
1
Another question on gplot
I am getting following strange error :
library(sn)
library(ggplot2)
dat1 <- as.matrix(rsn(1000, 0, 1, 0))[,1]
ggplot() + geom_histogram(aes(x = dat1, y = ..density.., fill = ..count..))
+
xlab("Distribution") + scale_y_continuous("")
Error: No data for layer
Can anyone please tell me why it is coming?
--
View this message in context:
2019 Mar 02
2
Getting the commit message from Phabricator
I'm not sure if this is well known, but it helped me so I thought I'd share
it with you.
When committing to gitmonorepo, (with git llvm push) you need to have
committed to your local repo first and so you need to have crafted your
commit message from your the Phabricator revision. (e.g. D12345)
Phabricator has the ability to give you this commit message it would have
used, even if you do
2009 Apr 21
0
ggplot2 version 0.8.3
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