Displaying 20 results from an estimated 8000 matches similar to: "Controlling the length of line with abline(lm())"
2008 Jun 10
3
Plotting multiple continuous lines with symbols
Hi,
I am trying to plot multiple lines on one plot such that all lines are of
the same color (black) and continuous. I need to distinguish these multiple
plots from each other by using different symbols (I am using pch=). However,
all my lines are broken on both sides of the symbols. This unfortunate (and
unsightly) behavior seems to be the default. In my search of the help
archives for R over
2009 Dec 05
1
R packages and assess to data in packages
Hi Everyone,
I have two very basic questions and would appreciate your help.
1. I would like to see/access the data that comes with a given R package by
using a function like read.table(). For example, I just installed car
package from CRAN. I know that somewhere within the package, there is
Duncan.txt file. I would not only like to look at it from file browser (or
using ls command in shell) but
2008 Jun 04
2
Superscript/Subscript in main title
I have been trying to figure out how to get superscript/subscript in the
main title for a plot. I have tried various approaches and suggestions but
none of them work. I am trying to get the following as the main title of my
plot:
Emission of CO2 with time
(but note that 2 is subscript.)
I have tried
plot(main="Emission of C"expression(O[2]) "with time")
and I get error
2008 Jun 18
1
Help with axis labels
Hi
I have patched together (from various sources) the following code to get
semi-logarithmic plot. Unfortunately, my labels come out also at
intermediate places between 10^2, 10^3, 10^4 etc. Since I put the code
together from various sources and do not understand fully how the code is
working, I have not been able to get rid of the labels like 10^1.69897,
10^2.69897 etc. I would appreciate if
2009 Nov 15
1
Help with unstack() function
Hi Everyone,
I am trying to understand the unstack() function but after struggling for
two days, I have given up. More specifically, I am trying the exercises at
the end of Chapter 1 of Data Analysis and Graphics Using R by Maindonald
and Braun, 2nd ed. Exercise 18 (p. 41) asks to unstack the Rabbit data frame
from the MASS package to get a certain data frame that is shown in the
exercise.
2010 Oct 04
1
Error message with scan() function
Hi Everyone,
I am new R user and am trying to learn by reading the online manual "An
Introduction to R" from the R web site. I am trying to practice using the
scan() function as explained in the manual. For this I first created three
vectors (one a character vector and two numeric one) and saved file
"input.dat" in my working directory as:
> label <- c("Bill",
2009 Oct 25
2
Help with history() in Emacs/ESS
Hi Everyone,
I am a beginner running R 2.9.2 under Ubuntu and typically use Emacs w/ESS.
However, I am confused with history() command. When I issue command
history() in Emacs within an R session, this is what get:
> history()
Error in savehistory(file) : no history available to save
Similarly, history(max=10) command gives the same error message.
However, there is this In/Out Menu in the
2002 Apr 18
1
grid lines outside plot region in version R1.4.1
Hello everybody,
if I'm using par(xpd=NA) gridlines will plotted outside the plotting region. This is "new" (and, in my
opinion, unaesthetic) in version 1.4 - compared to version 1.3. Is this a bug or a feature?
Example:
------------------
par(xpd=NA)
plot(1:11)
grid()
------------------
platform sparc-sun-solaris2.6
arch sparc
os solaris2.6
2008 Jun 16
1
Specifying fonts in R
Hi
I am a novice user of R. I got hold of "R Graphics" by P. Murrell the other
day and am trying to follow examples in the book. In chapter 3, the section
on font specification gives 16 "basic" font families and face combinations
available in R (Figure 3.9). However, the book also warns that even if a
font specification is given, it does not mean that the font will always be
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 appears
This behaves as documented, but might catch
someone. Would it be an improvement
2012 Dec 13
2
abline of an lm fit not correct
Hello fellow
R-users,
I’m stuck
with something i think is pretty stupid, but i can’t find out where i’m wrong,
and it’s turning me crazy!
I am doing
a very simple linear regression with Northing/Easting data, then I plot the
data as well as the regression line :
> plot(x=Dataset$EASTING,
y=Dataset$NORTHING)
> fit <- lm(formula = NORTHING ~ EASTING,
data = Dataset)
> abline(fit)
2010 Sep 20
3
How to set the limit of abline (regression line of lm)
Dear List,
I ran a regression model using lm and produced a regression line using
abline.
The line ranges from -20 to 20 in x axis,
and the section I only want is from -20 to 0.
Please kindly advise any function in abline () to set the range of x axes.
Thank you
Elaine
[[alternative HTML version deleted]]
2005 Jun 02
4
plot/lm/abline
Hi,
when I run
> plot.default(z1, z2, xlab = "x", ylab = "y", main = "xxxx", pch = "+")
> abline(lm(z1 ~ z2))
then the plot is plotted perfectly (scatterplot), however, the lm()
function doesnt appear on the plot. What could be wrong?
(Yesterday it worked perfectly, with the lm() line.)
Running R 2 on OS X.
Mathias Hunsk??r Furevik
Norway
2009 Jan 22
2
plot: abline() - define line length
Hi,
is there a way to define, that a line drawn via abline() should only
go from for example -2 to 1 on the x-axis (with something working
similiar to xlim()) ?
thanks for any help!
2006 Jan 20
3
abline() or predict.lm() when log="x"
Hello,
I'm trying to plot a fitted lm() line on a plot when the one
explanatory variable is log transformed and log="x". I get different
lines using abline and predict.lm().
#Example
x <- 1:100
y <- rnorm(100)
plot(y ~ x, log="x")
abline(lm(y ~ log(x)))
lines(x, predict(lm(y ~ log(x))), lwd=2)
I'm sure I'm missing something but could someone tell me which
2008 Aug 28
1
abline of an lm fit not correct
mac osx 10.5.4
R 2.7.1
I have fit a model
d<-lm(y~x)
with an R^2 of 0.963
but when I issue the command
abline(d)
the line is below where it ought to be. Looks like the right slope,
but not the right intercept.
thanks
--
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy
Let's not spend our time and resources thinking about things that are
so little or so large
2020 Oct 17
2
??? is to nls() as abline() is to lm() ?
I'm drawing a fitted normal distribution over a histogram. The use case is trivial (fitting normal distributions on densities) but I want to extend it to other fitting scenarios. What has stumped me so far is how to take the list that is returned by nls() and use it for curve(). I realize that I can easily do all of this with a few intermediate steps for any specific case. But I had expected
2008 Jul 16
1
Help Updating and Installing R Packages
Hi Everyone,
I have a few fairly basic questions about upgrading and installing R
packages. First off, I am using Ubuntu Hardy Heron and have R 2.7.1
installed and working perfectly. I usually access R via Emacs ESS interface
which I am still trying to get the hang of. My questions and issues are as
follows:
Question 1: I started R and wanted to upgrade the installed R packages. So,
I issue the
2020 Oct 17
0
??? is to nls() as abline() is to lm() ?
I haven't followed your example closely, but can't you use the predict()
method for this? To draw a curve, the function that will be used in
curve() sets up a newdata dataframe and passes it to predict(fit,
newdata= ...) to get predictions at those locations.
Duncan Murdoch
On 17/10/2020 5:27 a.m., Boris Steipe wrote:
> I'm drawing a fitted normal distribution over a
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?