similar to: ggplot2 geom_abline slope not working?

Displaying 20 results from an estimated 200 matches similar to: "ggplot2 geom_abline slope not working?"

2007 Oct 03
1
ggplot2: problem with geom_errorbar and geom_abline
Hi all, I have run into what appears to be a bug in ggplot2; however, I am new to the ggplot syntax, so I might be missing a key element. The main issue is that I cannot get geom_abline to plot when colour is used to identify "group" in the main plot. When I remove colour, geom_abline works but the error bars have an undesirable line drawn between the left edges of the caps. Does
2013 Nov 12
0
geom_abline does not seem to respect groups in facet_grid [ggplot2]
Just trying to understand how geom_abline works with facets in ggplot. By way of example, I have a dataset of student test scores. These are in a data table dt with 4 columns: student: unique student ID cohort: grouping factor for students (A, B, . H) subject: subject of the test (English, Math, Science) score: the test score for that student in that subject The goal is to compare
2020 Oct 23
2
How to shade area between lines in ggplot2
Thank you, but this split the area into two and distorts the shape of the plot. (compared to ``` p + geom_abline(slope = slope_1, intercept = intercept_1 - 1/w[2], linetype = "dashed", col = "royalblue") + geom_abline(slope = slope_1, intercept = intercept_1 + 1/w[2], linetype = "dashed", col = "royalblue") ``` Why there
2020 Oct 26
0
How to shade area between lines in ggplot2
Hi Put fill outside aes p+geom_ribbon(aes(ymin = slope_1*x + intercept_1 - 1/w[2], ymax = slope_1*x + intercept_1 + 1/w[2]), fill = "blue", alpha=0.1) The "hole" is because you have two levels of data (red and blue). To get rid of this you should put new data in ribbon call. Something like newdat <- trainset newdat$z <- factor(0) p+geom_ribbon(data=newdat, aes(ymin =
2020 Oct 23
2
How to shade area between lines in ggplot2
also from this site: https://plotly.com/ggplot2/geom_ribbon/ I get the answer is geom_ribbon but I am still missing something ``` #! plot p = ggplot(data = trainset, aes(x=x, y=y, color=z)) + geom_point() + scale_color_manual(values = c("red", "blue")) # show support vectors df_sv = trainset[svm_model$index, ] p = p + geom_point(data = df_sv, aes(x=x, y=y),
2020 Oct 23
0
How to shade area between lines in ggplot2
Hi What about something like p+geom_ribbon(aes(ymin = slope_1*x + intercept_1 - 1/w[2], ymax = slope_1*x + intercept_1 + 1/w[2], fill = "grey70", alpha=0.1)) Cheers Petr > -----Original Message----- > From: Luigi Marongiu <marongiu.luigi at gmail.com> > Sent: Friday, October 23, 2020 11:11 AM > To: PIKAL Petr <petr.pikal at precheza.cz> > Cc: r-help
2020 Oct 23
0
How to shade area between lines in ggplot2
Hi Did you try google? I got several answers using your question e.g. https://stackoverflow.com/questions/54687321/fill-area-between-lines-using-g gplot-in-r Cheers Petr > -----Original Message----- > From: R-help <r-help-bounces at r-project.org> On Behalf Of Luigi Marongiu > Sent: Friday, October 23, 2020 9:59 AM > To: r-help <r-help at r-project.org> > Subject:
2020 Oct 23
5
How to shade area between lines in ggplot2
Hello, I am running SVM and showing the results with ggplot2. The results include the decision boundaries, which are two dashed lines parallel to a solid line. I would like to remove the dashed lines and use a shaded area instead. How can I do that? Here is the code I wrote.. ``` library(e1071) library(ggplot2) set.seed(100) x1 = rnorm(100, mean = 0.2, sd = 0.1) y1 = rnorm(100, mean = 0.7, sd =
2011 Jul 10
2
grey colored lines and overwriting labels i qqplot2
I created this graph in ggplot and added ablines to the different facets by specifying with subset commands. As you might see, there are still a few issues. 1.) I would like to have the diamonds in a grey scale instead of colors. I accomplished this (see graph 2) until I overwrote the label title for the treatments and the colors came back (graph 1). I used these two commands: p=ggplot(data =
2009 Jan 29
2
Adding vertical line to histogram and qplot "stacked" plot
R-users it appears I am leaning on your knowledge once again.  Is there any way to add a vertical line to a histogram and qplot "stacked" plot?  Here is my current attempt:   "qplot" approach attempt: qplot(Run, data = data_dataframe, breaks = breaks, fill = Temperature, main = short_title) + scale_x_continuous("Data") + scale_y_continuous("Freq")
2011 Jun 26
1
changing graphs in qqplot2
This is what I have now so far. p=ggplot(data = test, aes(x = YEAR, y = TOTAL, colour = TREATMENT)) + geom_point() + geom_smooth(method = "lm", se=FALSE) + facet_wrap(~COUNTRY) > p +scale_x_continuous(limits=c(1,4)) http://r.789695.n4.nabble.com/file/n3626510/graph.gif I would also like to: 1.) change the headline for the faced wraps ?high? and ?low?. Is there any other way of
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 <-
2010 Apr 23
1
ggplot2: how to specify x-axis limits to geom_abline() ?
Hi all, I'd want to plot a segment from a line specified by slope and intercept. I want to plot this line between two limits, x1 and x2, without imposing these limits to the hole plot as it is the case with scale_x_continuous(limits=c(x1,x2)) or with xlim and ylim. Any idea? Arnaud Chozo [[alternative HTML version deleted]]
2007 Jul 24
1
ggplot2 axis color
Hi: Does anyone have an idea on how to color the axis and labels using ggplot2? This is what I got: library(ggplot2) p <- qplot(total_bill, tip, data = tips) NewPlot<- p + geom_abline(slope=c(0.1,0.15,0.2), colour=c("red","blue","yellow"),size=c(2,5,2)) NewPlot + geom_smooth(colour="green", size=3,linetype=3)
2023 May 16
1
Newbie: Drawing fitted lines on subset of data
Hello, I's still working with my tsibble of weight data for the last 20 years. In addition to drawing an overall trend line, using lm, for the whole data set, I'd like to draw short lines that would recompute lm and draw it, say, just for the years from 2010:2015. Here's a short example that I think illustrates what I'm trying to do. The commented out sections show what
2011 Dec 23
1
simple ggplot2 question
Hello, I am trying to make a plot using the code below. The plot is divided into two parts, using facet_grid. I would like the vertical axis (labelled 'place') to be different for each location (=part). So in the upper part, only places 'n' through 'z' are shown, while in the lower part, only places 'a' through 'm' are shown. I thought 'free_y'
2011 Sep 07
1
linear regression, log-transformation and plotting
Hello, I've some questions concerning log-transformations and plotting of the regression lines. So far as I know is it a problem to log-transform values smaller than 1 (0-1). In my statistics lecture I was told to do a log(x+1) transformation in such cases. So I provide here a small example to explain my questions: # Some example data for testing a1
2011 Nov 08
2
nesting scale_manual caracteristics in ggplot
Hi there, I am having a little problem with combining three scale_manual commands in a facet plot. I am not able to combine the three different characteristics, instead ending up with three different descriptions next to the graph for the same geom. I would like to see two separate labels (not three); one describing lines 1-7 and the other 8-14. For each of the treatments (A-B) I want a
2007 May 13
1
adding custom details to ggplot subplots
? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070513/ab60c7ed/attachment.pl
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