Displaying 20 results from an estimated 52 matches for "geom_hlin".
Did you mean:
geom_hline
2011 Jan 18
2
ggplot2, geom_hline and facet_grid
Hi
I have a long data set on which I want to do Bland-Altman style plots for each rhythm type
Using ggplot2, when I use geom_hline with facet_grid I get an extra set of empty panels.
I can't get it to do it with the "Diamonds" data supplied with the package so here is a (much abbreviated) example:
> lvexs
cvd_basestudy ecd_rhythm fixed_time variable_time
1 CBP05J02 AF 30.9000 29.422...
2007 Oct 14
1
ggplot2 geom_hline error
...39;ve run into a minor problem with ggplot2. In particular, I get
an error message when trying to plot a horizonal line through zero.
Here is what I do:
plt.df <- subset(xfm.df, select=c(stage, subj, tX))
plt <- ggplot(pp.df, aes(x=stage, y=tX, group=subj)) + geom_line()
plt
plt <- plt + geom_hline(intercept=0)
plt
The first plot yields a most lovely graph. Addition of the
geom_hline yields ...
"Error in eval(expr, envir, enclos) : object "subj" not found"
The data.frame that I'm plotting looks like this ...
> str(plt.df)
'data.frame': 468 obs. of 3...
2007 Dec 24
1
geom_hline
...ine is not drawn. If I set my intercept to 15
then it'll work but I dont want to hardcode it because
the Y axis parameters could be different for another
variable. I would like to alway set my hline along the
zero as default. Thanks
p <- ggplot(mtcars, aes(x = wt, y=mpg)) + geom_point()
p + geom_hline(intercept=0)
Felipe D. Carrillo
Fishery Biologist
US Fish & Wildlife Service
California, USA
____________________________________________________________________________________
Looking for last minute shopping deals?
2009 Feb 03
1
Time series plots with ggplot
Hi,
I am newbie user of ggplot and would like some assistance in
implementing time series plots.
I'd like to know how the tsdiag plot can be made in ggplot?
Thanks
Harsh Singhal
Decisions Systems,
Mu Sigma Inc.
2011 May 28
1
ggplot pale colors
...t;, "B"), Detail = c( "b", "c", "1", "2"), resp = runif(4, min = 0.5, max = 1))
ggplot(dataset, aes(x = Detail, y = resp)) +
facet_grid(.~Main, scales = "free_x")+ geom_point(aes( size=6,shape = c(16,16,15,15) ),colour="blue")+geom_hline(aes(yintercept=0.25),colour='blue', size=2)
with this code all the point are blue (like the line below)
But if i try the following code, where my goal is to have the point on the left blue and the one on the right red, a problem appears:
dataset <- data.frame(Main = c("A&quo...
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...
2010 Oct 19
3
plot CI and mortality rate
Dear R Users:
I have the individual mortality rate and 95% CI of 100 hospitals,
how to do the plot with the individual hospital in the Yaxis, and the
mortality rate and 95% CI in the Xais and a overall mean as a reference
line?
Thanks and regards,
Xin
[[alternative HTML version deleted]]
2023 Oct 30
1
Missing shapes in legend with scale_shape_manual
...size = 3) +
geom_point(aes(x = Date, y = bg, shape = missed_meds),
alpha = 0) + #Invisible point layer for shape mapping
scale_y_continuous(name = "Blood glucose (mg/dL)",
breaks = seq(100, 230, by = 20)
) +
geom_hline(yintercept = 130) +
scale_shape_manual(name = "Conditions",
labels = c("Missed meds",
"Missed exercise"),
values = c(20, 4),
## size = 3
)...
2013 Jan 08
2
plot residuals per factor
Dear R-users,
I want to plot residuals vs fitted for multiple groups with ggplot2.
I try this code, but unsuccessful.
library("plyr")
models<-dlply(dat1,"d",function(df)
mod<-lm(y~x,data=df)
ggplot(models,aes(.fitted,.resid), color=factor(d))+
geom_hline(yintercept=0,col="white",size=2)+
geom_point()+
geom_smooth(se=F)
--
---
Catalin-Constantin ROIBU
Forestry engineer, PhD
Forestry Faculty of Suceava
Str. Universitatii no. 13, Suceava, 720229, Romania
office phone +4 0230 52 29 78, ext. 531
mobile phone +4 0745 53 18 01...
2012 Jul 03
2
ggplot2: legend
...df, aes(x = x, y = y))
p + geom_point(aes(colour="Observations", shape="Observations")) +
stat_summary(aes(colour = "Means", shape ="Means"),
fun.y = mean, fun.ymin = min, fun.ymax = max,
geom = "point") +
geom_hline(aes(yintercept = mean(y), linetype = "Overall Mean"), show_guide = TRUE)
I tried to map the linetype in geom_point (and stat_summary) to NULL and I tried to set it to "blank" but neither worked.
Is it furthermore possible to combine the two legends? My preferred plot would ha...
2010 Jun 10
1
Order labels in qplot() - ggplot2 {help}
...;vp", "a", "b", "c")
p <- c(2, 2,1, 3,5)
pm<- c(3,4,2,5,4)
pn <- c(1,1,1,2,3)
x<-data.frame(cbind(n,p,pm,pn))
library(ggplot2)
qplot(x=n, y=p, data=x, ymin=pn, ymax=pm,
xlab='', ylab='', main='Order Label as: va vp a b c') +
geom_hline(yintercept = 2) +
geom_linerange() +
coord_flip()
Thanks!
[[alternative HTML version deleted]]
2011 May 16
1
Inverse autocorrelation fonction
...F=as.vector(acfth),Lag=as.numeric(names(acfth)))
ci <- 0.95
climy <- qnorm((1 + ci)/2) / sqrt(artest$n.used) ###Computing
significativity levels
q2 <- qplot(Lag, IACF, data = base, yend = 0, xend = Lag,
geom="bar",stat="identity",fill=I("Darkblue"))+theme_bw()+geom_hline(yintercept=c(-climy,climy),colour="red",linetype="dashed")+opts(title=expression(paste("Inverse
autocorrelogram of ",y[t])),plot.title = theme_text(size =
25))+geom_hline(yintercept=0)
q2
Hope this can help somebody
JB Lepetit
--
View this message in context:...
2012 Mar 05
2
ggplot2
...R 2.14 with ggplot2 0.9 and am finding bugs.
> ggplot2 "GPL-2" "2.14.0"
This example is taken from pg 101 in the ggplot book.
> plot <- qplot(date, psavert, data = economics, geom = "line") +
> ylab("Personal savings rate") + geom_hline(xintercept = 0, colour =
> "grey50")'
> plot + scale_x_date(major = "10 years")
Error in continuous_scale(aesthetics, "date", identity, breaks = breaks, :
unused argument(s) (major = "10 years")> plot + scale_x_date(limits =
as.Date(c("2...
2008 Dec 14
0
New version of ggplot2, 0.8.1
...order
* facet_wrap: now works when a layer doesn't contain every level of
the faceting variables
* geom_abline should now work in a wider variety of situations
* geom_smooth now gives correct asymmetric standard errors with
generalised linear models (thanks to Thierry Onkelinx)
* geom_vline and geom_hline now correctly transform their intercepts
if the scale is transformed
* geom_vline and geom_hline: now use xintercept and yintercept instead
of intercept
* legend.position and legend.justification work again
* position_dodge now works for any number of elements with smaller
widths, not just 2!
* sc...
2008 Dec 14
0
New version of ggplot2, 0.8.1
...order
* facet_wrap: now works when a layer doesn't contain every level of
the faceting variables
* geom_abline should now work in a wider variety of situations
* geom_smooth now gives correct asymmetric standard errors with
generalised linear models (thanks to Thierry Onkelinx)
* geom_vline and geom_hline now correctly transform their intercepts
if the scale is transformed
* geom_vline and geom_hline: now use xintercept and yintercept instead
of intercept
* legend.position and legend.justification work again
* position_dodge now works for any number of elements with smaller
widths, not just 2!
* sc...
2010 Jul 07
0
ggplot2 version 0.8.8
...es
(as defined by the coordinate system) to figure out how many pieces
each segment should be broken in to (thanks to prompting from
Jean-Olivier Irisson)
* fix ordering bug in facet_wrap (thanks to bug report by Frank Davenport)
* geom_errorh correctly responds to height parameter outside of aes
* geom_hline and geom_vline will not impact legend when used for fixed
intercepts
* geom_hline/geom_vline: intercept values not set quite correctly
which caused a problem in conjunction with transformed scales
(reported by Seth Finnegan)
* geom_line: can now stack lines again with position = "stack"...
2010 Jul 07
0
ggplot2 version 0.8.8
...es
(as defined by the coordinate system) to figure out how many pieces
each segment should be broken in to (thanks to prompting from
Jean-Olivier Irisson)
* fix ordering bug in facet_wrap (thanks to bug report by Frank Davenport)
* geom_errorh correctly responds to height parameter outside of aes
* geom_hline and geom_vline will not impact legend when used for fixed
intercepts
* geom_hline/geom_vline: intercept values not set quite correctly
which caused a problem in conjunction with transformed scales
(reported by Seth Finnegan)
* geom_line: can now stack lines again with position = "stack"...
2023 Oct 31
0
Missing shapes in legend with scale_shape_manual
...all would be like this:
ggplot(data = b2, aes(x = Date, y = bg)) +
geom_line() +
geom_point(aes(shape = medStat), size = 3)+
geom_point(aes(shape = exercise),size = 3)+
scale_y_continuous(name = "Blood glucose (mg/dL)",
breaks = seq(100, 230, by = 20)
) +
geom_hline(yintercept = 130) +
scale_shape_manual(name = "Conditions",
labels = c("Missed meds",
"Missed exercise"),
values = c(20, 4)
)
Note that this method then gets very close without the scale_s...
2017 Sep 26
2
Adding non-data line to legend ggplot2 Maximum Contaminant Level
...ot
p <- ggplot(data = MyData, aes(x=Year, y=Chloride , col=Detections)) +
geom_point(aes(shape=Detections)) +
#sets the detect vs. non-detect colors
scale_colour_manual(values=c("black","red")) +
#sets the y scale and log base 10
scale_y_log10() +
##adds line
geom_hline(aes(yintercept=250),linetype="dashed")+
#location of the legend
theme(legend.position=c("right")) +
#sets the line color, type and size
geom_line(colour="black", linetype="dotted", size=0.5) +
ylab("Chloride (mg/L)")
## does the graph...
2023 Oct 31
0
Missing shapes in legend with scale_shape_manual
...a = b2, aes(x = Date, y = bg)) +
> ? geom_line() +
> ? geom_point(aes(shape = medStat), size = 3)+
> ? geom_point(aes(shape = exercise),size = 3)+
> ? scale_y_continuous(name = "Blood glucose (mg/dL)",
> ???????????????????? breaks = seq(100, 230, by = 20)
> ? ) +
> ? geom_hline(yintercept = 130) +
> ? scale_shape_manual(name = "Conditions",
> ???????????????????? labels = c("Missed meds",
> ??????????????????????????????? "Missed exercise"),
> ???????????????????? values = c(20, 4)
> ? )
>
>
> Note that this method...