Displaying 20 results from an estimated 8000 matches similar to: "ggplot2: how to label lines?"
2009 Mar 03
1
ggplot2: annotated horizontal lines
Hello,
I'm using geom_hline to add a minimum line to my plot (representing
the best solution found so far by a search algorithm). I'd like to
annotate this line with it's numerical value to save trying to read it
off the graph, but I can't see a clear way to do this - any ideas?
(Alternatively, if this is against the spirit of the grammar of
graphics, is there a better
2009 Jul 30
4
Scatter Plot
Dear Sir
I want to write the numbers 1,2,3,----on a scatter plot instead of points,
like 1 corresponding to first point on plot, 2 corresponding second point
etc.
Help in this regard.
Regards
--
AMINA SHAHZADI
Department of Statistics
GC University Lahore, Pakistan.
[[alternative HTML version deleted]]
2010 Aug 11
2
help to polish plot in ggplot2
Hi,
I wanted to generate a plot which is almost like the plot generated by the
following codes.
category <- paste("Geographical Category", 1:10)
grp1 <- rnorm(10, mean=10, sd=10)
grp2 <- rnorm(10, mean=20, sd=10)
grp3 <- rnorm(10, mean=15, sd=10)
grp4 <- rnorm(10, mean=12, sd=10)
mydat <- data.frame(category,grp1,grp2,grp3,grp4)
dat.m <- melt(mydat)
p <-
2010 Sep 09
1
scalable < > delimiters in plotmath
Dear list,
I read in ?plotmath that I can use bgroup to draw scalable delimiters
such as [ ] and ( ). The same technique fails with < > however, and I
cannot find a workaround,
grid.text(expression(bgroup("<",atop(x,y),">")))
Error in bgroup("<", atop(x, y), ">") : invalid group delimiter
Regards,
baptiste
sessionInfo()
R version
2010 Sep 09
1
scalable < > delimiters in plotmath
Dear list,
I read in ?plotmath that I can use bgroup to draw scalable delimiters
such as [ ] and ( ). The same technique fails with < > however, and I
cannot find a workaround,
grid.text(expression(bgroup("<",atop(x,y),">")))
Error in bgroup("<", atop(x, y), ">") : invalid group delimiter
Regards,
baptiste
sessionInfo()
R version
2011 Apr 18
4
splom, plotmath: how to add three lines of information with alignment?
Dear expeRts,
I would like to create a scatter plot matrix with splom(). The lower panel should
contain some additional information about the samples shown in the upper panel
plot, see the splom() call below. Now two questions came up:
(1) The lower panels show "tau" and "alpha" on top of each other. How can I plot
*three* expressions on top of each other? I tried several
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")
>
2010 Aug 03
3
grid.table and expression in table body?
Hi,
Is there any way to get an expression into a data.frame, such that
"grid.table" from "gridExtra" will plot it evaluated in the table body? The
docu does it for the header, but is the body possible?
Thanks, Joh
2009 May 16
1
ggplot2: annotating plot with mathematical formulae
Hi,
Is there a way of annotating a ggplot plot with mathematical formulae?
I can do
geom_text(aes(label="some text", ...
but I can't do
geom_text(aes(label=expression(x^{n-1}), ...
It gives the error
Error: geom_text requires the following missing aesthetics: label
Is there a convenient equivalent?
Cheers,
Paul
2009 May 31
2
grid.edit() for ggplot2
Dear all,
I'm trying to access and modify grobs in a ggplot2 plot. The basic
idea for raw Grid objects I understand from Paul Murrell's R graphics
book, or this page of examples,
http://www.stat.auckland.ac.nz/~paul/grid/copygrob/copygrobs.R
However I can't figure out how to apply this to a ggplot (basically I
don't know how to write a syntactically correct gPath),
p
2009 May 27
3
Axis label spanning multiple plots
Hello
I need to plot 3 graphs in a single column; the top two plots have the
same title, and I would like it to be written only once, centered
horizontally and spanning the two plots. Something like
t +------------+
| |
i | |
| |
t +------------+
l +------------+
| |
e | |
| |
1 +------------+
t
2008 Jul 03
1
ggplot2 legend for vertical lines
Dear all,
The following example code produces a graph with ggplot2, to which I
add several vertical lines of arbitrary colors. I am not satisfied
with the legend: it automatically adds some vertical lines which I'd
rather not see (they confuse the reader rather than add information
in this case).
> library(ggplot2)
> dfr <- data.frame(values = sin(1:50/10),
> fact =
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
2009 Sep 28
2
dichromat, regexp, and grid objects
Dear list,
The dichromat package defines a dichromat function which "Collapses
red-green color distinctions to approximate the effect of the two
common forms of red-green colour blindness, protanopia and
deuteranopia."
library(dichromat)
library(grid)
colorStrip <-
function (colors = 1:3, draw = TRUE)
{
x <- seq(0, 1 - 1/length(colors), length = length(colors))
y <-
2009 Feb 11
2
Label bars in a faceted bar plot in ggplot2
Hi List,
I am running R 2.8.0 on a Windows XP machine, running ggplot2 version 0.8.1
I want to label the bars in a faceted grid barplot. Reproducible R
code is given below:
#### reproducible facet barplot #####
library(ggplot2)
# Dataset from which to create the barplot
ml <- rep(1:10,2)
vals <- rnorm(20,mean = 10, sd=1)
type <- c(rep("MAPE",10),rep("AIC",10))
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("") +
2009 Oct 08
2
proto and get()
Dear all,
In mucking around with ggplot2, I've hit the following snag,
library(ggplot2)
# this returns a grob, OK
GeomAbline$icon()
# lines[GRID.lines.9]
# this returns the function icon, OK
GeomAbline$icon
# proto method (instantiated with ): function (.)
# linesGrob(c(0, 1), c(0.2, 0.8))
# <environment: 0x13e6800>
Now I want to wrap this in a function,
getIcon <-
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 =
2010 Mar 10
4
write.fortran
Dear all,
I'm trying to write tabular data to a text file, these data will be
the input of a Fortran program. The format needs to be
"(i7,2x,7(e15.7,2x))". I have not been able to find a clean way of
producing this output with write.table. I searched for a
"write.fortran" function similar to read.fortran() in package utils
but I couldn't find any. Below is a small
2009 Dec 19
4
expand.grid game
Dear list,
In a little numbers game, I've hit a performance snag and I'm not sure
how to code this in C.
The game is the following: how many 8-digit numbers have the sum of
their digits equal to 17?
The brute-force answer could be:
maxi <- 9 # digits from 0 to 9
N <- 5 # 8 is too large
test <- 17 # for example's sake
sum(rowSums(do.call(expand.grid, c(list(1:maxi),