Displaying 20 results from an estimated 1262 matches for "abline".
2004 Mar 08
5
abline
if I want to specify y-coordinates for the heights of horizontal lines to go across a plot.
x <- c(1,2,3,6,4,8,4,7)
y <- c(3,2,7,4,5,4,5,6)
h <- c(3,5,7)
plot(x,y)
abline(y=h)
However I got error message:
Warning message:
parameter "y" couldn't be set in high-level plot() function
(I tried abline(h=y) , it;s not what I want also)
Do u know why?
---------------------------------
[[alternative HTML version deleted]]
2007 Jan 12
5
Regression lines
My simpleminded understanding of simple regression is that when
plotting regression lines for x on y and y on x in the same plot, the
lines should cross each other at the respective means. But, given the
R function below, abline (lm(y~x)) works fine, but abline (lm(x~y))
does not. Why?
function () {
attach (attitude)
x <- rating
y <- learning
detach (attitude)
plot (x, y)
abline(v=mean(x))
abline(h=mean(y))
abline (lm(y~x))
abline (lm(x~y))
}
2004 Mar 19
5
asp=1 and aspect ratio
Hi everyone
I want a square scatterplot with abline(0,1) going exactly through the
SW and NE corners. By "square" I mean that the plotting region is
exactly square, and that the axis limits are identical.
x <- 1:20
y <- x+rep(c(-1,1),10)
lims <- range(c(x,y))
None of the following do this:
plot(x,y) ; abline(0,1) #not...
2018 Jan 29
2
Add ablines
Good morning,
I have some problem adding ablines in Rstudio.
The lines drew by the software doesen?t match with the added values, what can I do?
pfaOK<-qcc(D[!trial], sizes=size[!trial], type="p", nsigmas=2, data.name="Polli positivi al Campylobacter")
pfaOK1<-qcc(D[!trial], sizes=size[!trial], type="p", data...
2018 Apr 06
1
Fast tau-estimator line does not appear on the plot
...cause the Y variable is 1 vector and should be a matrix ?
Here is the reproducible code
###############
X=c(5,3,2,4,7,6,9,3,7,11,1,6,4,5,6,9,4,5,34,2,1,3,12,8,9,7,4,12,19,21)
Y=c(25,24,23,19,17,14,13,14,25,13,17,25,14,13,19,25,16,16,20,21,25,19,12,11,9,28,21,10,2,8)
{reg1<-lm(Y ~ X)
plot(X,Y)
abline(reg1, col="black")
install.packages("robustbase")
library?(robustbase)
reg=lmrob(Y ~ X)
abline(reg, col="green")
install.packages("MASS")?
library(MASS)
Huber=rlm(Y ~ X)
abline(Huber,col="red")
Tukey=rlm(Y ~ X,psi=psi.bisquare)
abline(Tukey,col...
2018 Mar 31
0
Fast tau-estimator line does ot appear on the plot
On 31/03/2018 11:57 AM, varin sacha via R-help wrote:
> Dear R-experts,
>
> Here below my reproducible R code. I want to add many straight lines to a plot using "abline"
> The last fit (fast Tau-estimator, color yellow) will not appear on the plot. What is going wrong ?
> Many thanks for your reply.
>
It's not quite reproducible: you forgot the line to create Dataset.
It's probably something like
Dataset <- data.frame(Y, Z)
> ####...
2009 Oct 01
4
Color of graph
I am trying to plot a line graph for 3 or more regression lines
abline(m1)
abline(m2)
abline(m3)
Can I change the color of each line? if so how?
Thanks in advance
Ashta
[[alternative HTML version deleted]]
2010 Nov 27
1
How to add multiple ablines
Hi folks
Run;
> ToothGrowth
> attach(ToothGrowth)
> toothgrowth=lm(len~dose)
adding abline:
> abline(toothgrowth)
I got it done adding single abline.
How to add more ablines on the same diagram?
I found following thread, applying "mapply" command;
Plotting multiple ablines
http://www.mail-archive.com/r-help@r-project.org/msg51543.html
mapply(abline,
(converge$kY +...
2018 Mar 31
2
Fast tau-estimator line does ot appear on the plot
Dear R-experts,
Here below my reproducible R code. I want to add many straight lines to a plot using "abline"
The last fit (fast Tau-estimator, color yellow) will not appear on the plot. What is going wrong ?
Many thanks for your reply.
##########
Y=c(2,4,5,4,3,4,2,3,56,5,4,3,4,5,6,5,4,5,34,21,12,13,12,8,9,7,43,12,19,21)
Z=c(43,2,1,2,34,4,3,4,5,30,4,5,4,3,4,5,56,6,43,21,34,19,12,11,9,34,21,23,2,19)...
2018 Apr 07
0
Fast tau-estimator line does not appear on the plot
..." )
library(robustbase)
library(MASS)
library(quantreg)
library(RobPer)
X <- c(5,3,2,4,7,6,9,3,7,11,1,6,4,5,6,9,4,5,34,2,1,3,12,8,9,7,4,12,19,21)
Y <- c(25,24,23,19,17,14,13,14,25,13,17,25,14,13,19,25,16,16,20,21,25,19,12,11,9,28,21,10,2,8)
reg1 <- lm( Y ~ X )
plot( X, Y )
abline( reg1, col = "black" )
reg <- lmrob( Y ~ X )
abline( reg, col = "green" )
Huber <- rlm( Y ~ X )
abline( Huber, col="red" )
Tukey <- rlm( Y ~ X, psi = psi.bisquare )
abline( Tukey, col = "purple" )
L1 <- rq( Y ~ X, tau = 0....
2009 Mar 24
2
Properly labeling abline with text?
The result of the code shown below is posted at the following URL:
http://n2.nabble.com/Trying-to-properly-label-abline-td2524629.html
I would like to figure out a better way to label the horizontal abline.
I tried multiplying the text y position by a scale, but this didn't always put the text in a useful position. I guess I am curious if there is a preferred procedure for labeling the abline. Is there a w...
2007 Jun 21
2
abline plots at wrong abscissae after boxplot
Hi folks,
I'm using R 2.5.0 under ESS under Windows XP. (This also happens using
the Rgui application.)
I'm trying to add lines to a plot originally made with "boxplot", but
the lines appear in the wrong place. Below is a script that
illustrates the problem
# boxablinetest.R - script to show problem with abline on box plot
x <- c( 2, 2, 2, 3, 3, 3, 4, 4, 4)
y <- c( 1, 2, 3, 2, 3, 4, 3, 4, 5)
xymodel <- lm( y~x)
boxplot( y~x)
abline( xymodel) # Wrong abcissae
abline( v = 2.5) # Wrong abc...
2006 Dec 09
1
abline for intercept-only simple lm models (with and without offset)
The abline function can be used to draw the
regression line when one passes the lm object
as an argument.
However, if it's an intercept-only model,
it appears to use the intercept
as the slope of the abline:
mod <- lm(dist ~ 1, data = cars)
plot(dist ~ speed, data = cars)
abline(reg = mod) # nothing...
2005 Aug 03
1
abline and linearity over groups
Dear R users, please can you help me understand the behaviour of abline using function lm.
I'm trying to learn linearity over groups. So I make three groups with 10 values each:
test=data.frame(cbind(
l=c(rnorm(10,0,30),rnorm(10,100,30),rnorm(10,200,30)),
t = c(rep(0,10), rep(1,10), rep(2,10))
))
when I do:
plot(test$l~test$t)
abline(lm(test$l~test$t))
the a...
2013 Nov 19
2
como agrego una linea dibujada con abline() en la leyenda de un grafico ?
Eric
Recordé un ejemplo rápido
## Setup up coordinate system (with x == y aspect ratio):
plot(c(-2,3), c(-1,5), type = "n", xlab = "x", ylab = "y", asp = 1)
## the x- and y-axis, and an integer grid
abline(h = 0, v = 0, col = "gray60")
text(1,0, "abline( h = 0 )", col = "gray60", adj = c(0, -.1))
abline(h = -1:5, v = -2:3, col = "lightgray", lty = 3)
abline(a = 1, b = 2, col = 2)
text(1,3, "abline( 1, 2 )", col = 2, adj = c(-.1, -.1))
¿Es eso lo que...
2006 Jun 08
1
panel.abline and xyplot
Dear All,
I am wondering on how to use the abline.xyplot with xyplot such that I will have different vertical lines for each panel. More sepcifically, suppose that the xyplot generates 4 panels defined by the combination of two binary variables: X_1 and X_2. i.e.
xyplot(Y ~ Z | X_1*X_2, data = df)
I want something like:
abline...
2010 May 15
3
abline limit constrain x-range how?
Hello,
I managed to "linearize" my LDA decision boundaries now I would like to call abline three times but be able to specify the exact x range. I was reading the doc but it doesn't seem to support this use-case? are there alternatives. The reason why I use abline is because I first call plot to plot all the three datasets and then call abline to "append" these decision bou...
2008 Mar 11
2
(no subject)
# PROBLEM WITH ABLINE
# I have a question about a seemingly imprecise abline figure which I have
come accross now a few times.
# After reading variables a and b...
a<-c(3729,1796,1956,5177,3201,3138,4265,3042,3745,2060,5713,6811,4184,1221,4700,3171,8913,5565,5500,2428,4841,10428,11197,5946,2783,4842)
b<-c(7,3.4,4...
2009 Jul 28
2
xyplot, panel.abline, from, to
All,
I'm trying to truncate some lines that are added to an xyplot via
panel.abline to allow additional space for inserted text. According to
?panel.abline it seems like "from" and "to" will do the trick but it does
not work for the sample code below. Any hints much appreciated.
Cheers,
David
x = seq(1,8)
y.1 = .6*x + 3.5 + rnorm(8, 0, .5); y.2 = .4*x + 1 +...
2010 Nov 20
10
An empty grey diagram
Hi folks,
Win7 64bit
R 1.12.0
I run following command on R:-
> ToothGrowth
> attach(ToothGrowth)
> plot(dose,len)
> matrics=lm(len~dose)
> abline(metrics)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
plot.new has not been called yet
Only a grey diagram is displayed without content
> plot(abline(metrics))
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
plot.new has not been called yet
Wi...