Displaying 20 results from an estimated 4000 matches similar to: "ggplot2: annotating plot with mathematical formulae"
2011 Apr 22
1
ggplot
Hello everyone,
I am using ggplot
to plot but I am getting the following error which I do not understand
Error: geom_text requires the following missing aesthetics: label
My code is
dimx<-256
library(ggplot2)
dev.new()
xandy<-expand.grid(seq(1:dimx),seq(1:dimy))
xx<-data.frame(xandy[[1]],xandy[[2]],Powermap=Powermap)
subsetxx<-subset(xx, xx$Powermap>threshold)
2008 Aug 14
1
ggplot2: remove minor-horizontal guide before drawing
Hi,
I want to remove minor-horizontal and minor-vertical lines from a plot
generated with ggplot2. I can do this after the plot has been drawn
using grid.gremove.
However, I would like to do it before drawing my plot. The ggplot2 book
refers to a ggplotGrob function which creates a grob from a plot but
this function doesn't seem to exist in ggplot2 0.6.
Is there another way to do it?
2008 Nov 24
1
ggplot2: positioning legend on top of plot
Hi,
With ggplot2 v0.8, how do I position a legend on top of the plot. Things
like
p + opts(legend.position="top")
work ok. But
p + opts(legend.position=c(0.5,0.5))
gives
Error in as.character(x) :
cannot coerce type 'closure' to vector of type 'character'
so obviously I should be giving a string instead but I can't figure out
what it should be.
Thanks,
2009 Mar 30
2
ggplot2-geom_text()
Hi: I need help with geom_text().
I would like to count the number of Locations
and put the sum of it right above each bar.
x <- "Location Lake_dens Fish Pred
Lake1 1.132 1 0.115
Lake1 0.627 1 0.148
Lake1 1.324 1 0.104
Lake1 1.265 1 0.107
Lake2 1.074 0 0.096
Lake2 0.851 0 0.108
Lake2 1.098 0 0.095
Lake2 0.418 0 0.135
Lake2 1.256 1 0.088
Lake2 0.554 1 0.126
Lake2 1.247 1 0.088
2008 May 27
1
label outliers in geom_boxplot (ggplot2)
Dear List and Hadley,
I would like to have a boxplot with ggplot2 and have the outlier values
labelled with their "name" attribute. So I did
> library(ggplot2)
> dat=data.frame(num=rep(1,20), val=c(runif(18),3,3.5),
name=letters[1:20])
> p=ggplot(dat, aes(y=val, x=num))+geom_boxplot(outlier.size=4,
outlier.colour="green")
>
2012 Mar 02
0
ggplot2 0.9.0
# 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
complex multi-layered graphics.
Find out more at
2012 Mar 02
0
ggplot2 0.9.0
# 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
complex multi-layered graphics.
Find out more at
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
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
2017 Jun 27
0
ggplot2 geom_bar arrangement
You just have to change the levels of the factor ...
library(ggplot2)
Lab = c(letters[4:6], letters[1:3])
valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4)
df <- data.frame(Lab,valuex)
# set the factor levels to the same order as observed in the data frame
df$Lab <- factor(df$Lab, levels=unique(df$Lab))
px <- ggplot(df,aes(Lab,valuex,label=Lab)) +
geom_text(aes(y=0)) +
geom_bar(stat =
2009 Dec 22
0
ggplot2 version 0.8.5
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
2009 Dec 22
0
ggplot2 version 0.8.5
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
2008 Apr 04
0
ggplot2 - version 0.6
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
2008 Apr 04
0
ggplot2 - version 0.6
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
2017 Jun 27
4
ggplot2 geom_bar arrangement
Hi,
I was trying to draw a geom_bar plot. However, by default, the bars are
arranged according to the label, which I don't want. I want the bars to
appear exactly as they appear in the data frame. For example in the code:
Lab=c(letters[4:6],letters[1:3])
valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4)
df <- data.frame(Lab,valuex)
px <- ggplot(df,aes(Lab,valuex,label=Lab)) +
2009 Oct 23
1
ggplot2: stat_bin ..count.. with geom_text when NA is present
One for the ggplot2 gurus...
I have a function which makes a plot just fine if the response vector (res
in the example; fac1 is a factor) has no NA in it. It plots the data, then
makes a little annotation at the bottom with the data counts using:
p <- p + geom_text(aes(x = fac1, y = min(res) - 0.1 * diff(range(res)),
label = paste("n = ", ..count.. , sep =
2013 Oct 30
1
ggplot2 - how to get rid of bar boarder lines
Hello!
I am using ggplot2:
ggplot(myplotdata, aes(x=att_levels, y=WTP)) +
geom_bar(stat="identity",fill="dark orange",colour="black",
alpha = 1,position = "identity") +
geom_text(aes(label=WTP),colour="black",size=4,hjust=1.1,position='dodge') +
coord_flip() +
xlab("") +
2010 Sep 01
2
ggplot2 multiple group barchart
hi there.. i got a problem with ggplot2.
here my example:
library (ggplot2)
v1 <- c(1,2,3,3,4)
v2 <- c(4,3,1,1,9)
v3 <- c(3,5,7,2,9)
gender <- c("m","f","m","f","f")
d.data <- data.frame (v1, v2, v3, gender)
d.data
x <- names (d.data[1:3])
y <- mean (d.data[1:3])
pl <- ggplot (data=d.data, aes (x=x,y=y))
pl
2011 Oct 11
1
controling text in facets (ggplot2)
Hi R-helpers!
Here is my problem:
I have a graph with 3 different facets where there are 3 different
regression line. My goal is to mention separately in each facet each
equation that describes my lines.
So far, I managed to add a line and the same equation to all my facets but
that's not unfortunately what I want.
Is there a way to do that? Any suggestion would be gladly welcome!
Thanks
2013 Oct 30
1
ggplot2 question: keeping the order as in the input data
Hello!
I am using ggplot2 (see the code below) to plot the data in 'myplotdata'.
The first column of 'myplotdata' is called "att.levels" and contains
strings; the second column is called "WTP" and contains numeric values.
Notice - I use 'coord.flip()'
The command aes(x=att_levels, y=WTP), if I understand correctly, sorts
things alphabetically based on